SourceForge logo
SourceForge logo
Menu

matplotlib-devel

From: Joel B. M. <jm...@ga...> - 2013年12月06日 13:17:37
I'm getting a unicodeescape error importing matplotlib in the IPython 
notebook interface. The traceback is shown below. Annotate states that 
https://github.com/matplotlib/matplotlib/commit/bd71341ff645e1e4eb7470a5d2a5541e73bf6d5f 
introduced the changes to __init__.py which appears to have instigated 
the error. I was able to import matplotlib 1.3.1 in the IPython 
notebook. This traceback is appearing for me in both IPython 1.0.0 and 
1.1.0. I'm on win32 32-bit. I would appreciate feedback on whether 
this is a real regression or something on my system.
import matplotlib
---------------------------------------------------------------------------
UnicodeDecodeError Traceback (most recent call last)
<ipython-input-1-82be63b7783c> in <module>()
----> 1 import matplotlib
C:\Python27\lib\site-packages\matplotlib\__init__.py in <module>()
--> 240 class Verbose:
C:\Python27\lib\site-packages\matplotlib\__init__.py in Verbose()
--> 252 for arg in map(six.u, sys.argv[1:]):
C:\Python27\lib\site-packages\six.pyc in u(s)
--> 468 return unicode(s, "unicode_escape")
UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in position 
2-3: truncated \UXXXXXXXX escape
Thanks,
Joel
From: Thomas K. <th...@kl...> - 2013年12月06日 18:14:16
On 6 December 2013 04:55, Joel B. Mohler <jm...@ga...> wrote:
> C:\Python27\lib\site-packages\matplotlib\__init__.py in Verbose()
> --> 252 for arg in map(six.u, sys.argv[1:]):
> C:\Python27\lib\site-packages\six.pyc in u(s)
> --> 468 return unicode(s, "unicode_escape")
> UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in position
> 2-3: truncated \UXXXXXXXX escape
>
I'll bet that one of the arguments starts with C:\Users. It looks like
six.u() can't be applied to arbitrary input (it's intended for literals).
Thomas
From: Joel B. M. <jm...@ga...> - 2013年12月06日 18:36:00
On 12/6/2013 12:45 PM, Thomas Kluyver wrote:
> On 6 December 2013 04:55, Joel B. Mohler <jm...@ga... 
> <mailto:jm...@ga...>> wrote:
>
> C:\Python27\lib\site-packages\matplotlib\__init__.py in Verbose()
> --> 252 for arg in map(six.u, sys.argv[1:]):
> C:\Python27\lib\site-packages\six.pyc in u(s)
> --> 468 return unicode(s, "unicode_escape")
> UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in
> position
> 2-3: truncated \UXXXXXXXX escape
>
>
> I'll bet that one of the arguments starts with C:\Users. It looks like 
> six.u() can't be applied to arbitrary input (it's intended for literals).
Indeed, I suspect you are exactly right. After pondering the transcript 
below, I think it is bad idea to apply six.u to any sort of relatively 
unknown input. In any case, I believe this effectively breaks 
matplotlib in the IPython notebook on windows and other very simple 
things. Behold:
C:\>python -c "import matplotlib" any_old_thing_with_\u_in_it
Traceback (most recent call last):
 File "<string>", line 1, in <module>
 File "c:\python27\lib\site-packages\matplotlib\__init__.py", line 
240, in <module>
 class Verbose:
 File "c:\python27\lib\site-packages\matplotlib\__init__.py", line 
252, in Verbose
 for arg in map(six.u, sys.argv[1:]):
 File "c:\python27\lib\site-packages\six.py", line 468, in u
 return unicode(s, "unicode_escape")
UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in position 
19-20: truncated \uXXXX escape
It seems to me that this changeset needs to be rolled back, but I don't 
clearly see the problem that it was intended to fix.
Joel
From: Thomas K. <th...@kl...> - 2013年12月06日 19:27:32
On 6 December 2013 10:37, Joel B. Mohler <jm...@ga...> wrote:
> It seems to me that this changeset needs to be rolled back, but I don't
> clearly see the problem that it was intended to fix.
>
I assume that someone wanted to work with the arguments as text (i.e.
unicode) strings. A robust way to do this would be something like the
str_to_unicode function we have in IPython - it's a no-op on Python 3, and
does a robust decode (using errors='replace') on Python 2.
Thomas
From: Michael D. <md...@st...> - 2013年12月06日 19:33:09
I'll bring this to @minrk's attention in the original issue (#2534)
Mike
On 12/06/2013 02:20 PM, Thomas Kluyver wrote:
> On 6 December 2013 10:37, Joel B. Mohler <jm...@ga... 
> <mailto:jm...@ga...>> wrote:
>
> It seems to me that this changeset needs to be rolled back, but I
> don't clearly see the problem that it was intended to fix.
>
>
> I assume that someone wanted to work with the arguments as text (i.e. 
> unicode) strings. A robust way to do this would be something like the 
> str_to_unicode function we have in IPython - it's a no-op on Python 3, 
> and does a robust decode (using errors='replace') on Python 2.
>
> Thomas
>
>
> ------------------------------------------------------------------------------
> Sponsored by Intel(R) XDK
> Develop, test and display web and hybrid apps with a single code base.
> Download it for free now!
> http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
>
>
> _______________________________________________
> Matplotlib-devel mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
-- 
 _
|\/|o _|_ _. _ | | \.__ __|__|_|_ _ _ ._ _
| ||(_| |(_|(/_| |_/|(_)(/_|_ |_|_)(_)(_)| | |
http://www.droettboom.com
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /