pyqtgraph import error

Python und das Qt-Toolkit, erstellen von GUIs mittels des Qt-Designers.
Antworten
falk
User
Beiträge: 2
Registriert: Donnerstag 6. September 2012, 14:45

Hallo liebe Python-experten,

ich versuche das Python-Modul "pyqtgraph" zu importieren.

Leider erhalte ich ständig folgende Fehlermeldung:

>>> import pyqtgraph
Traceback (most recent call last):
File "<pyshell#9>", line 1, in <module>
import pyqtgraph
File "C:\Python32\lib\site-packages\pyqtgraph\__init__.py", line 129, in <module>
importAll('graphicsItems')
File "C:\Python32\lib\site-packages\pyqtgraph\__init__.py", line 120, in importAll
mod = __import__(path+"."+modName, globals(), locals(), fromlist=['*'])
File "C:\Python32\lib\site-packages\pyqtgraph\graphicsItems\ArrowItem.py", line 2, in <module>
import pyqtgraph.functions as fn
File "C:\Python32\lib\site-packages\pyqtgraph\functions.py", line 30, in <module>
import scipy.weave
File "C:\Python32\lib\site-packages\scipy\weave\__init__.py", line 22, in <module>
from .blitz_tools import blitz
File "C:\Python32\lib\site-packages\scipy\weave\blitz_tools.py", line 6, in <module>
from . import converters
File "C:\Python32\lib\site-packages\scipy\weave\converters.py", line 19, in <module>
c_spec.file_converter(),
File "C:\Python32\lib\site-packages\scipy\weave\c_spec.py", line 74, in __init__
self.init_info()
File "C:\Python32\lib\site-packages\scipy\weave\c_spec.py", line 264, in init_info
self.matching_types = [types.FileType]
AttributeError: 'module' object has no attribute 'FileType'

Dieser Fehler scheint vom Modul Scipy hervorgerufen zu werden.
Ich habe die den pyqtgraph-ordner in den Ordner site-packages kopiert.

Wie kann ich nun diesen Fehler beheben um mit dem Modul arbeiten zu können?

Beste Grüße

Falk
BlackJack

@falk: Einfach so einen Ordner kopieren ist etwas anderes als ordentlich zu installieren. Das geht in Python üblicherweise anders und ist sicher in der Dokumentation zu dem Modul oder Package beschrieben.

`types.FileType` gibt es in Python 3 nicht mehr, da stellt sich also die Frage ob `pyqtgraph` überhaupt schon mit Python 3 funktioniert.
falk
User
Beiträge: 2
Registriert: Donnerstag 6. September 2012, 14:45

@BlackJack:

Vielen Dank für die schnelle Antwort.

Du hast Recht bezüglich der Installation von Python-Modulen. Die Dokumentation von pyqtgraph sagt jedoch:

"Pyqtgraph currently does not have (or really require) any installation scripts. The only requirement is that the pyqtgraph folder to be placed someplace importable. Most people will prefer to simply place pyqtgraph within a larger project folder. If you want to make pyqtgraph available system-wide, copy pyqtgraph to one of the directories listed in python’s sys.path list."

Somit sollte die Installation entfallen.

Gibt es eine Alternative für types.FileType in Python 3, die ich selbst in das Modul integrieren könnte?
Nach der Fehlermeldung scheint das Problem im Modul Scipy.weave zu liegen und nicht im Modul von pyqtgraph selbst.

Beste Grüße,

Falk
BlackJack

@falk: `types.FileType` stammt noch aus Zeiten wo es das eingebaute `file` noch nicht als Typ gab.

Edit: In Python 2.7:

Code: Alles auswählen

In [3]: types.FileType is file
Out[3]: True
Antworten