Hi Istvan, Don't know what you're trying to do, but it looks like something complicated. Get the visualization part out of the subprocesses and I guess it will be better.
THomas 2011/6/21 Csanády István <istvancsan...@gmail.com> > The problem is caused by this bug: http://bugs.python.org/issue9867 I've > been trying to make a workaround, but unfortunately there are many other > process calls in the Xlib library, which are suffering from the same > issue.... Though I don't understand why aren't these exceptions raised when > I run a simple python code. Here is an example: > > #include <Python/Python.h> > > //#include <string> > > > int main (int argc, const char * argv[]) > > { > > > Py_Initialize(); > > PyRun_SimpleString("import sys;from OCC import V3d;import > subprocess;import time;)"); > > printf("%s\n",Py_GetPath()); > > > > //PyRun_AnyFile(fopen("/Users/istvancsanady/Documents/workspace/butterfly/__main__.py", > "r"), NULL); > > PyRun_SimpleString("v3d_module_library = > sys.modules['OCC._V3d'].__file__;p1 = > subprocess.Popen(['otool','-L','%s'%v3d_module_library],stdout=subprocess.PIPE);time.sleep(1);p2 > = > subprocess.Popen(['grep','-i','libTkOpenGl'],stdin=p1.stdout,stdout=subprocess.PIPE);time.sleep(1);output > = p2.communicate()[0]"); > > pause(); > > return 0; > > } > > > And the exception: > > > *Traceback (most recent call last):* > > * File "<string>", line 1, in <module>* > > * 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* > > * > * > > *Fortunately I can hardcode the linked libraries if I want to distribute > an app with pyocc, however this bug is a pain in my ass, because I can't > eliminate all process calls in the Xlib... * > > *Python version: 2.6* > > *Mac OS X 10.6.7* > > * > * > > *István* > > * > * > > On Mon, Jun 20, 2011 at 5:42 PM, Thomas Paviot <tpav...@gmail.com> wrote: > > 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 > > > > > > > _______________________________________________ > Pythonocc-users mailing list > Pythonocc-users@gna.org > https://mail.gna.org/listinfo/pythonocc-users > >
_______________________________________________ Pythonocc-users mailing list Pythonocc-users@gna.org https://mail.gna.org/listinfo/pythonocc-users