+ 7

[SOLVED] Why do I get unicode error (???) here?

Code: https://code.sololearn.com/cfR2Wid9KSWi/?ref=app Error: Traceback (most recent call last): File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 31, in <module> start(fakepyfile,mainpyfile) File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 30, in start exec(open(mainpyfile).read(), __main__.__dict__) File "<string>", line 81 SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 1006-1007: truncated \uXXXX escape I have never encountered this type of error before.

27th May 2018, 4:58 PM
DAB
DAB - avatar
5 Respostas
+ 13
seems like the problem comes from c:\users..., I first thought it's only the \u, but then I replaced it with \\u to escape the backslash, the error disappears, but if you print(y) you'll get a rather unexpected result, that I can not explain 🤔
27th May 2018, 5:43 PM
Nikolay Nachev
Nikolay Nachev - avatar
+ 11
It seems to be working now. I doubled the backslashes as Nikolay suggested (c:\\users\\........\\desktop\\lib\\site-packages) and got 1093 as the output. print(y) output this: Hi, I am not able to install packages (like PIL, scikits.learn etc ) in PyCharm! I am using PyCharm Community Edition 2018.1x64. Operating system - windows whenever I install PIL /scikits.learn an error is prompted. ERROR- Non-zero exit code(1) Command output- Could not find a version that satisfies the requirement PIL (from versions: ) No matching distribution found for PIL You are using pip version 9.0.1, however version 10.0.1 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command What I did? Considering above suggestion, I searched for cmd ran ''m pip install --upgrade pip" command. Outcome- 9.0.1 version of PIP was uninstalled and 10.0.1 was installed (figured this out from commands on cmd) But, even now am not able to install packages. Same error as mentioned above!) is being prompted. I again tried using command 'python -m pip install --upgrade pip'. But this time am getting notified as : Requirement already up-to-date:pip in ..\Playground\\........\desktop\lib\site-packages(10.0.1) Please help. Thanks in advance :)
28th May 2018, 1:27 AM
David Ashton
David Ashton - avatar
+ 10
seems to me that's the same issue but in the first string
27th May 2018, 6:06 PM
Nikolay Nachev
Nikolay Nachev - avatar
+ 6
The main issue is solved. However, print(y) throws this: Traceback (most recent call last): File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 31, in <module> start(fakepyfile,mainpyfile) File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 30, in start exec(open(mainpyfile).read(), __main__.__dict__) File "<string>", line 81 SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 1006-1007: truncated \uXXXX escape in pydroid 3 in android. Anyway, thanks Nikolay Nachev Sir, so glad to see you answer my question 😍🤩
27th May 2018, 5:56 PM
DAB
DAB - avatar
0
Traceback (most recent call last): File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 31, in <module> start(fakepyfile,mainpyfile) File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 30, in start exec(open(mainpyfile).read(), __main__.__dict__) File "<string>", line 39 print("\t2 : Linear Search") ^ IndentationError: unindent does not match any outer indentation level [Program finished]
27th Sep 2020, 8:51 AM
Kanchan Gaikwad
Kanchan Gaikwad - avatar