2011/6/20 Csanády István <istvancsan...@gmail.com>

> Hi All!
> I am trying to use pyocc from C++, with the embedded python api. If I
> run the app from XCode, I got the following errors when initializing
> SimpleGUI:
> Traceback (most recent call last):
>   File "???", line 7, in <module>
>   File "/Users/istvancsanady/Documents/workspace/butterfly/src/pool.py",
> line 12, in <module>
>     display, start_display, add_menu, add_function_to_menu = init_display()
>   File "/Library/Python/2.6/site-packages/OCC/Display/SimpleGui.py",
> line 173, in init_display
>     from XDisplay import XOCCWindow
>   File "/Library/Python/2.6/site-packages/OCC/Display/XDisplay.py",
> line 28, in <module>
>     import OCCViewer
>   File "/Library/Python/2.6/site-packages/OCC/Display/OCCViewer.py",
> line 77, in <module>
>     set_CSF_GraphicShr()
>   File "/Library/Python/2.6/site-packages/OCC/Display/OCCViewer.py",
> line 62, in set_CSF_GraphicShr
>     p2 =
> subprocess.Popen(['grep','-i','libTkOpenGl'],stdin=p1.stdout,stdout=subprocess.PIPE)
>   File
> "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py",
> line 595, in __init__
>     errread, errwrite)
>   File
> "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py",
> line 1101, in _execute_child
>     data = os.read(errpipe_read, 1048576) # Exceptions limited to 1 MB
> OSError: [Errno 4] Interrupted system call
> Or the other one:
> Traceback (most recent call last):
>   File "???", line 7, in <module>
>   File "/Users/istvancsanady/Documents/workspace/butterfly/src/pool.py",
> line 12, in <module>
>     display, start_display, add_menu, add_function_to_menu = init_display()
>   File "/Library/Python/2.6/site-packages/OCC/Display/SimpleGui.py",
> line 174, in init_display
>     win = XOCCWindow(display_xlib.Display(),"pythonOCC-%s 3d viewer
> ('python-xlib' backend)"%VERSION)
>   File "/Library/Python/2.6/site-packages/Xlib/display.py", line 83, in
> __init__
>     self.display = _BaseDisplay(display)
>   File "/Library/Python/2.6/site-packages/Xlib/display.py", line 65, in
> __init__
>     apply(protocol.display.Display.__init__, (self, ) + args, keys)
>   File "/Library/Python/2.6/site-packages/Xlib/protocol/display.py",
> line 44, in __init__
>     name, host, displayno, screenno = connect.get_display(display)
>   File "/Library/Python/2.6/site-packages/Xlib/support/connect.py",
> line 64, in get_display
>     mod = __import__(modname, globals())
>   File "/Library/Python/2.6/site-packages/Xlib/support/unix_connect.py",
> line 43, in <module>
>     uname = platform.uname()
>   File
> "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/platform.py",
> line 1194, in uname
>     processor = _syscmd_uname('-p','')
>   File
> "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/platform.py",
> line 950, in _syscmd_uname
>     output = string.strip(f.read())
> IOError: [Errno 4] Interrupted system call
>
> And another one:
>
> Traceback (most recent call last):
>  File "???", line 7, in <module>
>  File "/Users/istvancsanady/Documents/workspace/butterfly/src/pool.py",
> line 12, in <module>
>    display, start_display, add_menu, add_function_to_menu = init_display()
>  File "/Library/Python/2.6/site-packages/OCC/Display/SimpleGui.py",
> line 174, in init_display
>    win = XOCCWindow(display_xlib.Display(),"pythonOCC-%s 3d viewer
> ('python-xlib' backend)"%VERSION)
>  File "/Library/Python/2.6/site-packages/Xlib/display.py", line 83, in
> __init__
>    self.display = _BaseDisplay(display)
>  File "/Library/Python/2.6/site-packages/Xlib/display.py", line 65, in
> __init__
>    apply(protocol.display.Display.__init__, (self, ) + args, keys)
>  File "/Library/Python/2.6/site-packages/Xlib/protocol/display.py",
> line 44, in __init__
>    name, host, displayno, screenno = connect.get_display(display)
>  File "/Library/Python/2.6/site-packages/Xlib/support/connect.py",
> line 64, in get_display
>    mod = __import__(modname, globals())
>  File "/Library/Python/2.6/site-packages/Xlib/support/unix_connect.py",
> line 43, in <module>
>    uname = platform.uname()
>  File
> "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/platform.py",
> line 1194, in uname
>    processor = _syscmd_uname('-p','')
>  File
> "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/platform.py",
> line 950, in _syscmd_uname
>    output = string.strip(f.read())
> IOError: [Errno 4] Interrupted system call
>
>
>
> And the strangest thing: sometimes IT WORKS! If I start the app from
> Terminal or Finder, everything works always fine... Any ideas?
>
> István
>

Hi,

Reading the trace, I have the feeling you're trying to use multithreading or
multiprocessing. It's a bad idea to call a GUI from a specific thread (the
GUI mainloop generally conflicts with the subthread).

I can't help you further without any information about the code you're
running.

Thomas
_______________________________________________
Pythonocc-users mailing list
Pythonocc-users@gna.org
https://mail.gna.org/listinfo/pythonocc-users

Reply via email to