-
Notifications
You must be signed in to change notification settings - Fork 7
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
QT_API Error #29
Comments
Using from openalea.image.gui.point_selection import point_selection
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-2-d4b6dd0d5243> in <module>()
----> 1 from openalea.image.gui.point_selection import point_selection
/home/jonathan/Softwares/vp/openalea-components/image/src/image/gui/point_selection.py in <module>()
29 globals()[m] = mod.__getattribute__(m)
30
---> 31 from openalea.vpltk.qt import QtGui, QtCore
32 load_local(QtCore,'Qt,QObject,SIGNAL,QRectF,QPointF, QPoint')
33 load_local(QtGui,"""QApplication,QMainWindow,QGraphicsScene,QGraphicsPixmapItem,
/home/jonathan/Softwares/vp/openalea/vpltk/src/openalea/vpltk/qt/__init__.py in <module>()
166 autodetect()
167
--> 168 import openalea.vpltk.qt.designer
/home/jonathan/Softwares/vp/openalea/vpltk/src/openalea/vpltk/qt/designer.py in <module>()
92
93
---> 94 from openalea.vpltk.qt.uic import compileUi, compile_args
95
96
/home/jonathan/Softwares/vp/openalea/vpltk/src/openalea/vpltk/qt/uic.py in <module>()
9
10 try:
---> 11 if os.environ[QT_API] in PYQT5_API:
12 from PyQt5.QtNetwork import *
13 elif os.environ[QT_API] in PYQT4_API:
/usr/lib/python2.7/UserDict.pyc in __getitem__(self, key)
38 if hasattr(self.__class__, "__missing__"):
39 return self.__class__.__missing__(self, key)
---> 40 raise KeyError(key)
41 def __setitem__(self, key, item): self.data[key] = item
42 def __delitem__(self, key): del self.data[key]
KeyError: 'QT_API' |
It seems that you need to set the environment variable QT_API to pyqt or pyqt5 depending on what you have installed on your computer. Something like: |
It does work with ---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-1-82e79edf55ce> in <module>()
21 surf2reg, alti2reg = im2surface(imread(im2reg))
22 while not done:
---> 23 ps_ref = point_selection(surf_ref)
24 ps2reg = point_selection(surf2reg)
25 try:
/home/jonathan/Softwares/vp/openalea-components/image/src/image/gui/point_selection.pyc in point_selection(image, palette_name, color_index_max)
474 cmax = color_index_max
475 palette = palette_factory(palette_name,cmax)
--> 476 w.set_palette(palette)
477 w.show()
478 return w
/home/jonathan/Softwares/vp/openalea-components/image/src/image/gui/point_selection.pyc in set_palette(self, palette, palette_name)
268 ind = self._palette_select.findText(palette_name)
269 self._palette_select.setCurrentIndex(ind)
--> 270 self._view.set_palette(palette)
271 self.update_pix()
272
/home/jonathan/Softwares/vp/openalea-components/image/src/image/gui/pixmap_view.pyc in set_palette(self, palette, axis)
309
310 if self.image() is not None :
--> 311 self._reconstruct_pixmaps(axis)
312
313 def set_image (self, img) :
/home/jonathan/Softwares/vp/openalea-components/image/src/image/gui/pixmap_view.pyc in _reconstruct_pixmaps(self, axis)
213 # data.shape[1],
214 # QImage.Format_ARGB32)
--> 215 dat = to_pix (dat)
216 pix.append(dat.transformed(tr) )
217
/home/jonathan/Softwares/vp/openalea-components/image/src/image/gui/pixmap.pyc in to_pix(img, scalar_type, lut, forceNativeLut)
178 :Returns Type: QPixmap
179 """
--> 180 return QPixmap.fromImage(to_img(img, scalar_type, lut, forceNativeLut) )
181
182 def to_tex (img) :
/home/jonathan/Softwares/vp/openalea-components/image/src/image/gui/pixmap.pyc in to_img(img, scalar_type, lut, forceNativeLut)
58 raise Exception("Unknown image shape, cannot deduce pixel format")
59 _img = Image.fromarray(img)
---> 60 pseudo_QImage = ImageQt(_img)
61 return pseudo_QImage
62
/home/jonathan/Softwares/vp/openalea-components/image/src/image/pil/ImageQt.pyc in __init__(self, im)
67 elif im.mode == "RGBA":
68 try:
---> 69 data = im.tostring("raw", "BGRA")
70 except SystemError:
71 # workaround for earlier versions
/usr/lib/python2.7/dist-packages/PIL/Image.pyc in tostring(self, *args, **kw)
693 def tostring(self, *args, **kw):
694 raise Exception("tostring() has been removed. " +
--> 695 "Please call tobytes() instead.")
696
697 def tobitmap(self, name="image"):
Exception: tostring() has been removed. Please call tobytes() instead. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, I wanted to use the
point_selection
function from the original release of MARS in OpenAlea.This function can be imported from
openalea-components
:from openalea.image.gui.point_selection import point_selection
However I cannot make it work, using either
ipython
,ipython --gui=qt
norpython
... I always get the following error message:Could someone help/tell me what could be done to try and solve this?
Thanks, Jo
The text was updated successfully, but these errors were encountered: