Looks like your script is not able to find _mgapilib.pyd
I suspect you missed the new addition to the docs on how to set up for standalone execution of scripts.
From the OpenFlight 22 docs:
Depending on which version of Python you want to use, you must copy the corresponding mgapilib.pyd from either the Python2 or Python3 subfolder into the parent bin_x64\release folder. All of the OpenFlight Script module files must be in the same folder before you can run OpenFlight Script in a stand alone program environment.
When we started supporting Python2 and Python3 simultaneously, we had to make two versions of _mgapilib.pyd. One for Python2 and one for Python3. If you notice, there are two folders in ../Suite22/OpenFlight_API_22_0/BIN_X64 named Python2 and Python3. each of these folders contains the _mgapilib.pyd for the corresponding version of python.
Just copy this file into the parent directory. (Note: don't cut or move the file because you will need to keep it around in case you switch back and forth from python2 to python3)
Hm. Yeah, I missed that.
OK, file is copied from Suite22\OpenFlight_API_22_0\bin_x64\release\Python3.
Python is 3.8.0:
E:\Nads\ProjectData\Databases\miniSim\TMT\simple_rural\simple_rural2\flt>python --version
Python 3.8.0
Similar issues remain:
E:\Nads\ProjectData\Databases\miniSim\TMT\simple_rural\simple_rural2\flt>python e:\utils\get_flt_comment.py 2ln_3way_3x1_-1320x_0y_0r.flt
Traceback (most recent call last):
File "C:\Presagis\Suite22\OpenFlight_API_22_0\bin_x64\release\mgapilib.py", line 14, in swig_import_helper
return importlib.import_module(mname)
File "C:\Python\Python38\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 657, in _load_unlocked
File "<frozen importlib._bootstrap>", line 556, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 1101, in create_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: DLL load failed while importing _mgapilib: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "e:\utils\get_flt_comment.py", line 25, in <module>
from mgapilib import *
File "C:\Presagis\Suite22\OpenFlight_API_22_0\bin_x64\release\mgapilib.py", line 17, in <module>
_mgapilib = swig_import_helper()
File "C:\Presagis\Suite22\OpenFlight_API_22_0\bin_x64\release\mgapilib.py", line 16, in swig_import_helper
return importlib.import_module('_mgapilib')
File "C:\Python\Python38\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: DLL load failed while importing _mgapilib: The specified module could not be found.
sorry.
Is your environment variable: PRESAGIS_OPENFLIGHT_SCRIPT set up?
Well - it's set, but I can't say it's right..
points to C:\Presagis\Suite22\OpenFlight_API_22_0\bin_x64\release
hm... that should have done it. It looks like you have everything set up that I can think of.
Oh and double check that C:\Python\Python38 is the correct path to your python install.
Will do, and I'll try rebooting the PC as well. Thx
OK, removed _pycache_, rebooted PC. Same error.
I just installed the API today, does it make sense to think it's been corrupted? I did a complete install, but I chose Visual Studio 2017 for which files to use.
Gr. Sorry, make that Visual Studio 2015 (VC14)
OpenFlight_API_Release_Notes - page 7:
If you are developing standalone scripts, you will also need to install Python 2.7.x.
Is this true? I have 278 installed but it's not in the C:\Python folder, it lives in it's own folder.
I also do not have PRESAGIS_OPENFLIGHT_PLUGIN_DIR set (p11, Release Notes).
*I copied the 278 into c:\Python, no changes to environment variables, same error.
E:\Nads\ProjectData\Databases\_dev\flt>set PYTHON
PYTHONHOME=C:\Python\Python38
PYTHONPATH=C:\Presagis\Suite22\OpenFlight_API_22_0\bin_x64\release
Any ideas what I should try next?
The API is built using Python 3.7.6. I doubt it, but perhaps the Python 3.8 you have installed is not compatible with 3.7.6 causing an issue.
I'll do some tests on my side and see if I can figure anything else out.
thanks!
Shawn
Greetings,
Would like to run my old python scripts, started pre 3.0 but modified with print() so in theory they should work. I'll try to drop my script here, but I think this is a configuration issue. Suite 22 API contains python 2 and python 3.
Here's the error I get:
Traceback (most recent call last):
File "C:\Presagis\Suite22\OpenFlight_API_22_0\bin_x64\release\mgapilib.py", line 14, in swig_import_helper
return importlib.import_module(mname)
File "C:\Python\Python38\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named '_mgapilib'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "e:\utils\get_flt_comment.py", line 25, in <module>
from mgapilib import *
File "C:\Presagis\Suite22\OpenFlight_API_22_0\bin_x64\release\mgapilib.py", line 17, in <module>
_mgapilib = swig_import_helper()
File "C:\Presagis\Suite22\OpenFlight_API_22_0\bin_x64\release\mgapilib.py", line 16, in swig_import_helper
return importlib.import_module('_mgapilib')
File "C:\Python\Python38\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_mgapilib'
Here's the path:
PYTHONHOME=C:\Python\Python38
PYTHONPATH=C:\Presagis\Suite22\OpenFlight_API_22_0\bin_x64\release
Here's the script?