-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Importing a module with debugger causes "TypeError: decoding Unicode is not supported" #2245
Comments
Sorry for the problem. I introduced this bug when trying to fix debugging of non-ascii files on Windows. I'll fix it in 2.3.4 |
Great. Thanks for the quick fix! |
Unfortunately, I still am having trouble with this in v2.3.4. The debugger works properly when I import a module that is in the same directory as my script. However, I still get
when I import a module that is somewhere else on my PYTHONPATH. |
I missed that other instance of Please take a look at issue #2277 to see where the fix needs to be applied. |
Good to hear it can get fixed easily and that I won't have to wait for another release! I am confused by your suggestion to "see where the fix needs to be applied". As just a user of spyder, I don't know where the fix should be applied. Did you mean "whether" instead of "where"? I took a look at #2277, and it looks like @greenorca fixed his/her problem by clearing the breakpoints from imported modules, so I am not sure anything more needs to be done. In my case, I created a fresh script with one line of code importing a module on my PYTHONPATH. In the module I just had a single print statement, and then set a breakpoint on the print statement. |
Sorry for not being clear enough @stretch97. I meant that you need to look at the commit referenced in #2277 and apply it yourself to |
I just tried the commit referenced in #2277, and it did not work. I then changed the commit from
to
and it worked. @ccordoba12, you may want to update the commit. Regardless, thanks for the help! |
Description
Expected output: 'It worked!' should print to the console.
Observed output:
Traceback (most recent call last):
File "", line 1, in
File "/Users/breedlu/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 700, in debugfile
debugger.run("runfile(%r, args=%r, wdir=%r)" % (filename, args, wdir))
File "/Applications/Canopy.app/appdata/canopy-1.5.1.2730.macosx-x86_64/Canopy.app/Contents/lib/python2.7/bdb.py", line 400, in run
exec cmd in globals, locals
File "", line 1, in
File "/Users/breedlu/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 680, in runfile
execfile(filename, namespace)
File "/Users/breedlu/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 78, in execfile
builtins.execfile(filename, *where)
File "/Users/breedlu/Desktop/generic_script.py", line 8, in
import generic_module
File "/Users/(username)/Documents/Python_Routines/generic_module.py", line 6, in
"""
File "/Users/(username)/Documents/Python_Routines/generic_module.py", line 6, in
"""
File "/Applications/Canopy.app/appdata/canopy-1.5.1.2730.macosx-x86_64/Canopy.app/Contents/lib/python2.7/bdb.py", line 49, in trace_dispatch
return self.dispatch_line(frame)
File "/Applications/Canopy.app/appdata/canopy-1.5.1.2730.macosx-x86_64/Canopy.app/Contents/lib/python2.7/bdb.py", line 66, in dispatch_line
if self.stop_here(frame) or self.break_here(frame):
File "/Users/breedlu/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 515, in break_here
filename = unicode(filename, "utf-8")
TypeError: decoding Unicode is not supported
When I use the pdb debugger explicitly with "import pdb" and "pdb.set_trace()" the issue does not occur.
In case it matters, I am using the full 64-bit version of Enthought Canopy python. I built spyder from source using Canopy.
Version and main components
Optional dependencies
pyflakes >=0.5.0: 0.8.1 (OK)
pep8 >=0.6 : 1.5.7 (OK)
IPython >=1.0 : 2.4.1 (OK)
zmq >=2.1.11 : 14.5.0 (OK)
pygments >=1.6 : 2.0.2 (OK)
pandas >=0.13.1 : 0.15.2 (OK)
sphinx >=0.6.6 : 1.2.3 (OK)
psutil >=0.3 : 2.2.0 (OK)
jedi >=0.8.1 : None (NOK)
rope >=0.9.2 : 0.9.4 (OK)
matplotlib >=1.0: 1.4.2 (OK)
sympy >=0.7.0 : 0.7.6 (OK)
pylint >=0.25 : 0.25.1 (OK)
The text was updated successfully, but these errors were encountered: