Home

Collaborative development portal

Search form

  • Sign in
  • Get involved
  • Resources
    • Download
    • Issue tracker
    • Git repository
    • Components
    • Online-documentation
    • Training & E-learning
    • Technical support
    • FAQ
    • Licensing
  • Blog
  • Forum
    • All Forums
    • Active Topics
  • About
  • Research & Science
  • Projects & Products
  • Contact us

Problems using PythonOCC with Python2.6

m.Heil's picture
m.Heil
Tue, 11/03/2009 - 18:22
Forums: 
pythonOCC
See More

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

  • Log in to post comments
jelle's picture
jelle
Tue, 11/03/2009 - 18:37

> 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

  • Log in to post comments
Thomas Paviot's picture
Thomas Paviot
Tue, 11/03/2009 - 19:51

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

  • Log in to post comments
m.Heil's picture
m.Heil
Wed, 11/04/2009 - 18:20

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

  • Log in to post comments
jelle's picture
jelle
Wed, 11/04/2009 - 22:11

terrific! happy to have you on board ;')

  • Log in to post comments
Jarkko Nieminen's picture
Jarkko Nieminen
Mon, 10/07/2013 - 18:48

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?

  • Log in to post comments

© 2011-2022 OPEN CASCADE SAS
Terms of Use Privacy Policy
Cookie Policy Cookie settings
Open cascade in Facebook
Contact us