我有这个python代码块...
79 print "debug top is [" + top + "]"
80 print "debug package is [" + package + "]"
81 print "debug version is [" + version + "]"
82 print "debug password is [" + password + "]"
83 print "debug app_image_url is [" + app_image_url + "]"
84 print "debug apptitle is [" + apptitle + "]"
85 # get_filenames_from_zip_file (app_zip_url)
86 # sys.exit(0)
87 print """---
88 top: '%s'
89 package: '%s'
90 version: %s
91 password: '%s'
92 make_audiobook::package_name: "%%{hiera('package')}"
93 make_audiobook::version: "%%{hiera('version')}"
94 make_audiobook::mp3filesdir: "%%{hiera('top')}/%%{::appname}/%%{::appname}/res/raw"
95 make_audiobook::app_image::app_image_url: '%s'
96 make_audiobook::app_image::resource_path: "%%{hiera('top')}/%%{::appname}/%%{::appname}"
97 make_audiobook::app_image::appdir: "%{hiera('top')}/%{::appname}"
98 make_audiobook::app_image::appname: "%{::appname}"
99 make_audiobook::app_javacode::appname: "%%{::appname}"
100 make_audiobook::app_javacode::password: "%%{hiera('password')}"
101 make_audiobook::app_javacode::apptitle: "%s"
102 make_audiobook::app_javacode::package: "%%{hiera('package')}"
103 make_audiobook::app_javacode::path_to_code: "%%{hiera('top')}/%%{::appname}/%%{::appname}/src/com/%%{hiera('package')}/%%{::appname}"
104 make_audiobook::app_javacode::path_to_androidmanifest: "%%{hiera('top')}/%%{::appname}/%%{::appname}"
105 make_audiobook::app_javacode::version: "%%{hiera('version')}"
106 make_audiobook::app_javacode::tracks: """ % (top, package, version, password, app_image_url, apptitle)
当我运行我的脚本时,我在输出中收到此错误:
debug top is [/home/get_links/TEMPLATE_FILES]
debug package is [redcricket]
debug version is [1]
debug password is [XXXXXX]
debug app_image_url is [https://ia801509.us.archive.org/7/items/song_of_the_wave_1703_librivox/songwave_1703.jpg]
debug apptitle is [Song of the Wave, and Other Poems]
Traceback (most recent call last):
File "./make_hiera_data_from_librivox_api.py", line 137, in <module>
main(sys.argv[1:])
File "./make_hiera_data_from_librivox_api.py", line 106, in main
make_audiobook::app_javacode::tracks: """ % (top, package, version, password, app_image_url, apptitle)
ValueError: unsupported format character '{' (0x7b) at index 415
我在那段代码中看不出任何错误。也许第二双眼睛会有帮助吗?
答案 0 :(得分:2)
main.Hab main.Avail main.Used50K
1 <NA> 4.186001 0.7795595
2 BOG 8.128698 1.4224366
3 F 12.294499 0.4780462
4 OIP 43.902867 69.9860934
5 RG 7.488637 2.3009635
6 RIP 9.713074 22.7798587
7 UM 14.286223 2.2530800
的所有实例都需要替换为%{
例如这个
%%{
应该是
%{::appname}