ich beschäftige mich nun seit einigen Tagen mit Python3 und seinen Erweiterungen numpy, scipy, matplotlib.
Ich habe ein Problem mit string und byte Typen in Python3. Besser gesagt ich versteh es einfach nicht! :K
Hier mal mein konkretes Problem:
Code: Alles auswählen
[martin@thinkpad-w510 ~]$ python3
Python 3.3.0 (default, Sep 29 2012, 22:07:38)
[GCC 4.7.2 20120921 (Red Hat 4.7.2-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> import scipy as sp
>>> import matplotlib as mpl
>>> import matplotlib.pyplot as plt
>>> plt.plot([1, 3, 7, 8])
[<matplotlib.lines.Line2D object at 0x7f8ffcd957d0>]
>>> plt.show()
Code: Alles auswählen
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib64/python3.3/tkinter/__init__.py", line 1442, in __call__
return self.func(*args)
File "/usr/lib64/python3.3/site-packages/matplotlib/backends/backend_tkagg.py", line 276, in resize
self.show()
File "/usr/lib64/python3.3/site-packages/matplotlib/backends/backend_tkagg.py", line 348, in draw
FigureCanvasAgg.draw(self)
File "/usr/lib64/python3.3/site-packages/matplotlib/backends/backend_agg.py", line 439, in draw
self.figure.draw(self.renderer)
File "/usr/lib64/python3.3/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/usr/lib64/python3.3/site-packages/matplotlib/figure.py", line 1000, in draw
func(*args)
File "/usr/lib64/python3.3/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/usr/lib64/python3.3/site-packages/matplotlib/axes.py", line 2088, in draw
a.draw(renderer)
File "/usr/lib64/python3.3/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/usr/lib64/python3.3/site-packages/matplotlib/axis.py", line 1051, in draw
renderer)
File "/usr/lib64/python3.3/site-packages/matplotlib/axis.py", line 1000, in _get_tick_bboxes
extent = tick.label1.get_window_extent(renderer)
File "/usr/lib64/python3.3/site-packages/matplotlib/text.py", line 753, in get_window_extent
bbox, info = self._get_layout(self._renderer)
File "/usr/lib64/python3.3/site-packages/matplotlib/text.py", line 305, in _get_layout
ismath=False)
File "/usr/lib64/python3.3/site-packages/matplotlib/backends/backend_agg.py", line 208, in get_text_width_height_descent
font = self._get_agg_font(prop)
File "/usr/lib64/python3.3/site-packages/matplotlib/backends/backend_agg.py", line 246, in _get_agg_font
fname = findfont(prop)
File "/usr/lib64/python3.3/site-packages/matplotlib/font_manager.py", line 1299, in findfont
result = fc_match(prop, fontext)
File "/usr/lib64/python3.3/site-packages/matplotlib/font_manager.py", line 1283, in fc_match
for match in _fc_match_regex.finditer(output):
TypeError: can't use a string pattern on a bytes-like object
Python3 (3.3.0)
numpy (1.7.0.rc1)
scipy (0.12.0.b1)
matplotlib (1.2.0)
auf Fedora-Linux (18-x86_64)
Hier noch die die "defaultencoding" Ausgabe:
Code: Alles auswählen
>>> import sys
>>> sys.platform
'linux'
>>> sys.getdefaultencoding()
'utf-8'
Gruß M!