Everything related to SDK.
By lifeofdave
#387105
Hi All

So after a long break from OSX I've come back to package some maxwell scripts up for Mac, and I'm hitting an early early on.

I've installed python using homebrew 'brew install python', then copied pymaxwell.py and _pymaxwell.so to /usr/local/lib/python2.7/site-packages, but then when I try to import pymaxwell I get this error:

Fatal Python error: PyThreadState_Get: no current thread

Googling suggests the cause could be a conflict between the native OSX python and the installed python, but I'm still unsure how to go about fixing it. Any ideas anyone?

I'm gonna keep trying to fix this, but any pointers really appreciated..
#387107
similar problem with Macports and python 2.6 64bit:

>>> from pymaxwell import *
Fatal Python error: Interpreter not initialized (version mismatch?)
Abort trap: 6

Is pymaxwell compiled against apple's native python?
User avatar
By Brany
#387110
It is a known issue and we don't know how to fix it for now. We build pymaxwell against official releases of python (and the one included with osx) and it works for us.
Code: Select all
maxwell$ python
Python 2.7.5 (default, Mar  9 2014, 22:15:05) 
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path.insert(0,'/path/where/copied/Libs/pymaxwell/python2.7/pyandsofiles')
>>> import pymaxwell
>>> print(pymaxwell.Cmaxwell.getEngineVersion())
3.1.1.0
Please make sure that you're loading the right pymaxwell for python2.6/2.7. I just tried to load pymaxwell for python 2.6 from a python 2.7 console and I got the very same error you posted. You can check all paths in sys.path, maybe you have a pymaxwell.py/_pymaxwell.so files for an old installation
Code: Select all
import sys
for i in sys.path:
    print i
Clean pymaxwell from all these paths so you be sure that python can't find pymaxwell, and then, copy pymaxwell in one of these listed paths from sys.path.

It is a good practice to avoid copying pymaxwell files into a system folder. It is dangerous because you can loose the track of where your pymaxwell modules are. I prefer to tell the sys modules where pymaxwell is by code:
Code: Select all
import sys
sys.path.insert(0,'/path/to/pymaxwell/modules')
import pymaxwell
#387114
Hi Brany

pymaxwell works for me using Apple's python included with OSX, but I can't get it to function with any other version of python. For basic scripts this isn't a problem, but for the project I'm currently working on I need to use PyQt and then bundle everything up using py2app, which I don't think is possible with Apple's modified/included python.

Apple Python (all good):
Code: Select all
Daves-Mac:~ dave$ python
Python 2.7.3 (default, May 19 2013, 04:22:38) 
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.51)] on darwin
>>> import pymaxwell
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named pymaxwell
>>> import sys
>>> sys.path.insert(0,'/Users/dave/Desktop/pymaxwell/python2.7')
>>> import pymaxwell
Macports python 2.6 (uho):
Code: Select all
Daves-Mac:~ dave$ python2
Python 2.6.9 (unknown, May 25 2015, 13:02:23) 
[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> import pymaxwell
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named pymaxwell
>>> sys.path.insert(0,'/Users/dave/Desktop/pymaxwell/python2.6')
>>> import pymaxwell
Fatal Python error: Interpreter not initialized (version mismatch?)
Abort trap: 6
Is there anything else I can try? Have you had success with pymaxwell and any python releases on OSX apart from the included apple one?

Thanks for your reply, it's a good first step to know it's a known issue!
User avatar
By Brany
#387119
I suspect that in some point the system tries to use the default's system python loading pymaxwell, instead of the current python running one. In windows/linux we have no problem with this. Maybe there is a way to modify the _pymaxwell.so file, so it will link dinamically with the python_.so the user wants in an explicit way.
User avatar
By Brany
#387127
What version of OSX have you installed?
You are not able to load pymaxwell from the python that OSX delivers? Which version of python is, 2.6 or 2.7?
Did you search for all _pymaxwell.so in your system and removed it (all but the /Applications/Maxwell 3/Libs/pymaxwell...)?
Can you try to install python from here https://www.python.org/downloads/?
#387132
I have OSX 10.9 installed. I am able to load pymaxwell from the python that comes with OSX, the problem is that the version of python already with OSX is not suitable for development generally, especially when it comes to using the pyqt libraries.
I have searched for _pymaxwell.so everywhere, it is not in any of the site-packages folders.

I just download python 2.7.10 from python.org, but unfortunately I still get this error:
Code: Select all
Python 2.7.10 (v2.7.10:15c95b7d81dc, May 23 2015, 09:33:12) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path.insert(0,'/Users/dave/Desktop/pymaxwell/python2.7')
>>> import pymaxwell
Fatal Python error: PyThreadState_Get: no current thread
Abort trap: 6
anything else worth trying?
User avatar
By Brany
#387168
Sorry, we have to do some research to find out what is happening here. We had other clients that tried to load pymaxwell in osx in other python distributions (anaconda), and even using that distribution headers and libs to build the pymaxwell module, the "Fatal Python error: PyThreadState_Get: no current thread" still happen.
#387559
Hi Brany

So the new build plays nicely with python 2.7.10 downloaded from https://www.python.org/downloads/ :)

however... when I try it with python 2.7.10 installed using homebrew I still get the same PyThreadState_Get error. I need to do a bit more research into this myself, but in the meantime wondered if you have any ideas, or if it's easy to build another pymaxwell against homebrew python 2.7.10?

Thanks for helping with the dreaded threadset error.. much appreciated!

...and 3 Days later, 82.528 Views !!! ...NL, every[…]

Hello dear customers, We have just released a new[…]

grass generator extension

Just downloaded MWR5 for Rhino 6 and want to use g[…]

Hello everyone, I have a new bug with the latest M[…]