Problems using PythonOCC with Python2.6

Forums: 

Hello guys,

i downloaded and installed PythonOCC like written on the pythonOCC homepage and with simply testing :

from OCC import *

i got this error:

Traceback (most recent call last):
File "
", line 1, in
from OCC import *
File "C:\Python26\lib\site-packages\OCC\Standard.py", line 28, in
_Standard = swig_import_helper()
File "C:\Python26\lib\site-packages\OCC\Standard.py", line 27, in swig_import_helper
return _mod
UnboundLocalError: local variable '_mod' referenced before assignment

i already searched for help a lot of places, but found nothing. I think there is an error in load_module, cause on removing try and finally commands i get another error about a wrong dll version. I reached my horizon and hope someone can help me with this.

Thanks a lot

jelle's picture

> i already searched for help a lot of places

Well, you didn't find pythonocc.org ;') ( the pythonocc.org mailing list is a more appropriate place to talk pythonocc )
Have a look at the ( many ) samples that come with pythonocc!
The samples do provide you a great place to get familiar with pythonocc.

You'll see in the examples that you should import a submodule of the OCC module ( OCC is _huge_ you don't want to import it all at once ). So try "from OCC.gp import * " than you will find gp_Pnt for example.

examples:
http://download.gna.org/pythonocc/source_release/pythonOCC-0.3-samples.tgz

Thanks for your interest in pythonocc.

-jelle

Thomas Paviot's picture

Hi Heil,

This error generally occurs when shared libraries (.DLL if you run Windows) cannot be loaded (whether they're not in your PATH or there are linkage issues). According to the traceback, you run Python26 on Windows. I suggest you download/install the 'all_in_one' package for pythonOCC-0.3.

Best Regards,

Thomas

m.Heil's picture

thanks for help all,
i've found the pythonocc.org page ;) but it was a windows problem ... after admin reinstallation everything works well ...

jelle's picture

terrific! happy to have you on board ;')

Jarkko Nieminen's picture

I doubt you will be following this thread after 4 years, but I have exactly the same problem that you have. I have installed the 'all_in_one'- package and I am using python 2.6. Each time I try to use PythonOCC module I get an error message. For example:

from OCC import *
File "C:\Python26\lib\site-packages\OCC\Standard.py", line 28, in
_Standard = swig_import_helper()
File "C:\Python26\lib\site-packages\OCC\Standard.py", line 27, in swig_import_helper
return _mod
UnboundLocalError: local variable '_mod' referenced before assignment

I am using 64-bit windows 7. Could that the cause of problems?