Hi Pascal, i also thought about the python version, but the utm library was working in rhino and grasshopper before today so i don’t understand what has changed. I’m running rhino 7
I’d guess that perhaps numpy got installed by pandas, and that may fail with IronPython. The utm module will try to import numpy if it is available.
Anyway, instead of relying on code completion just do
import utm
print(utm)
If it prints the module path without problem then import worked just fine. That code completion doesn’t work doesn’t mean that the module wasn’t imported and incapacitated.
Someone else had this same error earlier this week.
utm attempts to support numpy data types, but will fall back to a core math library otherwise. This fallback path is what’s needed in RhinoPython.
However if anything has exposed certain versions of CPython numpy to Rhino Python, then when you import numpy you will recreate that “unexpected token ‘from’” error. It’s not a from in an import from or from X import Y, it’s CPython 3 syntax raise Z from W, because after a certain version numpy dropped Python 2 compatibility.
numpy would always fail to import or function in RhinoPython as soon as it hits compiled C-code. The only unusual thing here is the strange “from” token error masking the real issue.
I made a patch for the utm in shrimpGIS. Give me about an hour and I’ll upload a version of utm that doesn’t use numpy.
Hi David. If you’re still having this problem, you can try this version of utm with all the numpy stripped out. It’s not on PyPi but is still installable locally using pip but you have to download it, unzip it and pip install .
No worries. I didn’t realise setup.py had produced a .tar.gz, was that the problem?
It’s on PyPi for you now anyway.
This is the first package I’ve put on there. I can install it into a venv, but please can you do me a favour and let me know if the commands below work?:
By the way there’s no need to alias an import with the same name it’s imported with. And in that try block, you should try and catch the syntax error only “unexpected token from”. This won’t mask all other possible errors that might occur in import utm, and can then let your users know what the fix is too.