Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

2015-05-12 Thread zljubisicmob
I would say so as well. Thanks to everyone who helped. Regards and best wishes. -- https://mail.python.org/mailman/listinfo/python-list

Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

2015-05-10 Thread Dave Angel
On 05/10/2015 05:10 PM, zljubisic...@gmail.com wrote: 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

Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

2015-05-10 Thread zljubisicmob
> 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/P

Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

2015-05-10 Thread zljubisicmob
> > It works, but if you change title = title[:232] to title = title[:233], > > you will get "FileNotFoundError: [Errno 2] No such file or directory". > > > Which is a *completely different* error from > > SyntaxError: 'unicodeescape' codec can't decode bytes in position 2-3: > truncated \U

Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

2015-05-09 Thread Chris Angelico
On Sun, May 10, 2015 at 1:13 AM, Steven D'Aprano wrote: > FileNotFoundError means that the program did run, it tried to open a file, > but the file doesn't exist. Normally it does, at least. Sometimes it means that a *directory* doesn't exist (for instance, you can get this when you try to create

Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

2015-05-09 Thread Steven D'Aprano
On Sat, 9 May 2015 08:31 pm, zljubisic...@gmail.com wrote: > It works, but if you change title = title[:232] to title = title[:233], > you will get "FileNotFoundError: [Errno 2] No such file or directory". Which is a *completely different* error from SyntaxError: 'unicodeescape' codec can't de

Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

2015-05-09 Thread Dave Angel
On 05/09/2015 06:31 AM, zljubisic...@gmail.com wrote: title = title[:232] title = title.replace(" ", "_").replace("/", "_").replace("!", "_").replace("?", "_")\ .replace('"', "_").replace(':', "_").replace(',', "_").replace('"', '')\ .replace('\n', '_'

Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

2015-05-09 Thread zljubisicmob
Steven, please do look at the code bellow: # C:\Users\zoran\PycharmProjects\mm_align\hrt3.cfg contents # [Dir] # ROOTDIR = C:\Users\zoran\hrt import os import shutil import configparser import requests import re Config = configparser.ConfigParser() Config.optionxform = str # preserve case in i

Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

2015-05-08 Thread Steven D'Aprano
On Sat, 9 May 2015 06:39 am, zljubisic...@gmail.com wrote: > Thanks for clarifying. > Looks like the error message was wrong. No, the error message was right. Your problem was that you used backslashes in *Python program code*, rather than reading it from a text file. In Python, a string-litera

Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

2015-05-08 Thread Chris Angelico
On Sat, May 9, 2015 at 5:00 AM, wrote: > But it returns the following error: > > > C:\Python34\python.exe C:/Users/bckslash_test.py > File "C:/Users/bckslash_test.py", line 4 > ROOTDIR = 'C:\Users' > ^ > SyntaxError: (unicode error)

Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

2015-05-08 Thread zljubisicmob
Thanks for clarifying. Looks like the error message was wrong. On windows ntfs I had a file name more than 259 characters which is widows limit. After cutting file name to 259 characters everything works as it should. If I cut file name to 260 characters I get the error from subject which is wron

Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

2015-05-08 Thread MRAB
file1, file2) But it returns the following error: C:\Python34\python.exe C:/Users/bckslash_test.py File "C:/Users/bckslash_test.py", line 4 ROOTDIR = 'C:\Users' ^ SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in

Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

2015-05-08 Thread random832
On Fri, May 8, 2015, at 15:00, zljubisic...@gmail.com wrote: > As I saw, I could solve the problem by changing line 4 to (small letter > "r" before string: > ROOTDIR = r'C:\Users\zoran' > > but that is not an option for me because I am using configparser in order > to read the ROOTDIR from underly

SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

2015-05-08 Thread zljubisicmob
or: C:\Python34\python.exe C:/Users/bckslash_test.py File "C:/Users/bckslash_test.py", line 4 ROOTDIR = 'C:\Users' ^ SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \U escape Process