Start a new topic

fltdata.dll fails to load from Python Script

Original Post by: jhodge Mon Jun 21 19:59:16 2010


I'm not sure if anyone else has run into this issue before and I wanted to pass along this tip.


I have been searching for a way to run and debug standalone python scripts from eclipse for the Creator API 4.1. I have set up the environment, checked the registry on the WinXp 32 os, and correctly set up all environment variables according to the api user documentation. For the last week, I have been running into the issue where when calling upon mgInit, Error Code 126 would be shown and the console would state that the "fltdata.dll" could not be loaded.


The solution was to drop the fltdata.dll into the folder containing myScript.py


Maybe this is an unwritten rule that is widely understood, so for those of you like myself that could not figure this out, hopefully this will help resolve the issue for you.


Additionally, if there is an alternative method to execute this, I would love to hear it.


Cheers


Original Post by: ChrisRogers Mon Jun 21 20:38:22 2010


At first I thought this was due to an incorrectly set up PYTHONPATH environmental variable. However, a fellow engineer pointed out the error of my ways. PYTHONPATH is not used to locate fltdata.dll. PYTHONPATH is only used by Python to locate files it loads. fltdata.dll is loaded by mgInit (via LoadLibrary) so PYTHONPATH won't help. Prior to version 4.1, this was very problematic and one of the solutions was to move fltdata.dll to the script folder. However in 4.1, we have made it much easier.


Here is an excerpt from the user guide:

-----------

After installing a Python environment on your computer, you must tell Python where to

locate the OpenFlight Script module. The OpenFlight Script module is comprised of the

OpenFlight API dynamic link libraries (including fltdata.dll) and two additional

Python specific files included in the OpenFlight API distribution. These additional Python

files are:

• _mgapilib.pyd (Release) or _mgapilib_d.pyd (Debug)

• mgapilib.py


Both Python files (and the dynamic link library files) are located in:

$(PRESAGIS_OPENFLIGHT_API)\bin\debug (Win32)

or

$(PRESAGIS_OPENFLIGHT_API)\bin\release (x64)


Here are the steps to make the OpenFlight Script module available in Python:

• Set the PYTHONPATH environment variable to include the folder where the OpenFlight

Script module files (dynamic link library files, _mgapilib.pyd and mgapilib.py)

are located.

• Set the PRESAGIS_OPENFLIGHT_SCRIPT environment variable to be the folder

where the OpenFlight Script module files are located.

-----------


So in your case, if you simply set the PRESAGIS_OPENFLIGHT_SCRIPT environment variable, you should not have to put fltdata.dll in your script folder. Also note that you will have to restart eclipse after setting the environment variable. Please let us know if this still does not work after setting PRESAGIS_OPENFLIGHT_SCRIPT. Under no circumstances should you have to relocate fltdata.dll and if you still find you must, we’d like to understand why.

Original Post by: jhodge Tue Jun 22 14:37:40 2010


Excellent. The PRESAGIS_OPENFLIGHT_SCRIPT environment variable was set for the user variables. I added this to the system variables, relaunched Eclipse, and now everything seems to be running smoothly.


Thank you

Original Post by: SteveThompson Tue Jun 22 15:49:18 2010


Hmmm... I'm curious why it mattered whether this var was USER or SYSTEM level. I would have thought either would work.


In any event, glad this is working for you.

Original Post by: jhodge Wed Jun 23 14:32:08 2010


Hmmm... I'm curious why it mattered whether this var was USER or SYSTEM level. I would have thought either would work.


In any event, glad this is working for you.


Looking back, I may not have restarted Eclipse after setting the USER variables. And like you said, there shouldn't have been a problem with using the USER or SYSTEM.


Thanks

Login to post a comment