Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #90307
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2015-05-10 14:10 -0700 |
| References | (1 earlier) <mailman.260.1431113391.12865.python-list@python.org> <8360473a-45ac-4270-9bf3-81932da5f223@googlegroups.com> <554d768d$0$13000$c3e8da3$5496439d@news.astraweb.com> <580ee0d6-a703-4da3-af2d-105589a1780f@googlegroups.com> <mailman.282.1431174340.12865.python-list@python.org> |
| Message-ID | <d06f180f-bc6f-4610-b8cb-a6335ee5a2ce@googlegroups.com> (permalink) |
| Subject | Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape |
| From | zljubisicmob@gmail.com |
> No, we can't see what ROOTDIR is, since you read it from the config
> file. And you don't show us the results of those prints. You don't
> even show us the full exception, or even the line it fails on.
Sorry I forgot. This is the output of the script:
C:\Python34\python.exe C:/Users/zoran/PycharmProjects/mm_align/bckslash_test.py
C:\Users\zoran\hrt
Traceback (most recent call last):
File "C:/Users/zoran/PycharmProjects/mm_align/bckslash_test.py", line 43, in <module>
with open(src_file, mode='w', encoding='utf-8') as s_file:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\zoran\\hrt\\src_70._godišnjica_pobjede_nad_fašizmom_Zašto_većina_čelnika_Europske_unije_bojkotira_vojnu_paradu_u_Moskvi__Kako_će_se_obljetnica_pobjede_nad_nacističkom_Njemačkom_i_njenim_satelitima_obilježiti_u_našoj_zemlji__Hoće_li_Josip_Broz_Tito_o.txt'
70._godišnjica_pobjede_nad_fašizmom_Zašto_većina_čelnika_Europske_unije_bojkotira_vojnu_paradu_u_Moskvi__Kako_će_se_obljetnica_pobjede_nad_nacističkom_Njemačkom_i_njenim_satelitima_obilježiti_u_našoj_zemlji__Hoće_li_Josip_Broz_Tito_o
260 C:\Users\zoran\hrt\src_70._godišnjica_pobjede_nad_fašizmom_Zašto_većina_čelnika_Europske_unije_bojkotira_vojnu_paradu_u_Moskvi__Kako_će_se_obljetnica_pobjede_nad_nacističkom_Njemačkom_i_njenim_satelitima_obilježiti_u_našoj_zemlji__Hoće_li_Josip_Broz_Tito_o.txt
260 C:\Users\zoran\hrt\des_70._godišnjica_pobjede_nad_fašizmom_Zašto_većina_čelnika_Europske_unije_bojkotira_vojnu_paradu_u_Moskvi__Kako_će_se_obljetnica_pobjede_nad_nacističkom_Njemačkom_i_njenim_satelitima_obilježiti_u_našoj_zemlji__Hoće_li_Josip_Broz_Tito_o.txt
Process finished with exit code 1
Cfg file has the following contents:
C:\Users\zoran\PycharmProjects\mm_align\hrt3.cfg contents
[Dir]
ROOTDIR = C:\Users\zoran\hrt
> I doubt that the problem is in the ROODIR value, but of course nothing
> in your program bothers to check that that directory exists. I expect
> you either have too many characters total, or the 232th character is a
> strange one. Or perhaps title has a backslash in it (you took care of
> forward slash).
How to determine that?
> While we're at it, if you do have an OS limitation on size, your code is
> truncating at the wrong point. You need to truncate the title based on
> the total size of src_file and dst_file, and since the code cannot know
> the size of ROOTDIR, you need to include that in your figuring.
Well, in my program I am defining a file name as category-id-description.mp3.
If the file is too long I am cutting description (it wasn't clear from my example).
Regards.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape zljubisicmob@gmail.com - 2015-05-08 12:00 -0700
Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape random832@fastmail.us - 2015-05-08 15:29 -0400
Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape zljubisicmob@gmail.com - 2015-05-08 13:39 -0700
Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-09 12:53 +1000
Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape zljubisicmob@gmail.com - 2015-05-09 03:31 -0700
Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape Dave Angel <davea@davea.name> - 2015-05-09 08:25 -0400
Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape zljubisicmob@gmail.com - 2015-05-10 14:10 -0700
Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape Dave Angel <davea@davea.name> - 2015-05-10 21:33 -0400
Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape zljubisicmob@gmail.com - 2015-05-12 11:57 -0700
Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-10 01:13 +1000
Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape Chris Angelico <rosuav@gmail.com> - 2015-05-10 01:22 +1000
Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape zljubisicmob@gmail.com - 2015-05-10 14:14 -0700
Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape MRAB <python@mrabarnett.plus.com> - 2015-05-08 20:33 +0100
Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape Chris Angelico <rosuav@gmail.com> - 2015-05-09 08:54 +1000
csiph-web