Shawn, the output from your python interpreter suggests it is a 32 bit version of Python.
Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win32
That will not work with a 64 bit version of the OpenFlight API.
Either find and install a 64 bit version of Python or set
PYTHONPATH and PRESAGIS_OPENFLIGHT_SCRIPT to the 32 bit folders of the OF API bin folder.
what else can I investigate to get this issue resolved, do you think?
Sounds like you might have multiple layers of problems. Let's attack this one layer at a time. From what you say on this thread, I suspect you have OpenFlight Script set up ok but there is some other module you are using in your script that is having trouble.
First let's verify that OpenFlight Script is set up correctly on your computer. Then we'll look at why your script may be failing.
To verify OF Script is set up correctly, do this:
Bonne idee.
Here's the script:
from mgapilib import * mgInit(None,None) mgExit()
Here's my output:
Type of m_counter: <type 'int'>
Label! 0
go: 1
Label! 1
go: 2
Label! 2
go: 3
Label! 3
go: 4
Label! 4
go: 5
Label! 5
go: 6
Label! 6
go: 7
Label! 7
go: 8
Label! 8
go: 9
Label! 9
go: 10
Label! 10
go: 11
Label! 11
go: 12
Label! 12
go: 13
Label! 13
go: 14
Label! 14
go: 15
Label! 15
go: 16
Label! 16
go: 17
Label! 17
go: 18
Label! 18
go: 19
Label! 19
go: 20
Label! 20
go: 21
m_counter is: 21
Length of m_list: 21
test 2
['test']
bike_lane 3
['bike_lane', ' 207, 209, 179']
city 3
['city', ' 250, 167, 7']
comm 3
['comm', ' 205, 153, 51']
dmba 3
['dmba', ' 109, 76, 57']
filler 3
['filler', ' 194, 205, 205']
fwy 3
['fwy', ' 90, 90, 90']
hasselt 3
['hasselt', ' 214, 37, 225']
ind 3
['ind', ' 156, 111, 23']
LH_rural 3
['LH_rural', ' 150, 120, 100']
man_ln 3
['man_ln', ' 200, 117, 51']
mtn 3
['mtn', ' 36, 188, 197']
nves 3
['nves', ' 220, 220, 220']
railroad 3
['railroad', ' 100, 140, 250']
res 3
['res', ' 100, 200, 100']
rotated 3
['rotated', ' 174, 242, 9']
rural 3
['rural', ' 105, 140, 33']
rural2 3
['rural2', ' 180, 100, 50']
suburb 3
['suburb', ' 166, 164, 58']
special 3
['special', ' 249, 7, 7']
urban 4
['urban', ' 252, 198, 93', [['4ln_urban_4x8_01', 'urban_2ln_4ln_s1400', 'urban_2ln_4ln_s1400A', 'urban_3way', 'urban_4ln_10x8_01', 'urban_4ln_arterial_01', 'urban_4ln_arterial_02', 'urban_4ln_arterial_03', 'urban_4ln_arterial_04', 'urban_4ln_crv2100', 'urban_4ln_s1400_6x3', 'urban_4ln_s1400_6x3_tunnel_02', 'urban_4ln_s3600_6x5_tunnel01', 'urban_4ln_straight_01', 'urban_4ln_trans_01', 'urban_6ln_4ln_transition', 'urban_6ln_4ln_transition_day', 'urban_90', 'urban_90_02', 'urban_ichg_00', 'urban_ichg_00_day', 'urban_ichg_01', 'urban_ichg_01_day']]]
I'm running the python script from the command line (not powershell) and the script is in that folder (where the shell is open to).
Might not have mentioned the specific version before:
E:\utils>python
Python 2.7.8 (default, Jun 30 2014, 16:08:48) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
Ok, so we have OpenFlight Script working properly, that is good.
I can't tell what is wrong with the script output you provided without looking at the script itself. For all I can tell, it's working fine ;-)
Can you share the script or at least tell us why you believe the output suggests it's not working properly?
re: output - please re-read my post. The entire script is at the top :)
There is no output in the script, so I really don't know how/why it gets generated.
Thx
Ok, I think I am starting to understand. I have no idea where that output is coming from. To help isolate a bit more split your script into its component 3 lines and run each line separately. Let me know when that output is printed by python. i.e. which of the 3 lines actually triggers that output.
Thanks
OK, the first line (import) generates output:
from mgapilib import *
Splitting off the other 2 lines have predictable results at least:
E:\utils>python ptest2.py
Traceback (most recent call last):
File "ptest2.py", line 1, in <module>
mgInit(None,None)
NameError: name 'mgInit' is not defined
E:\utils>emacs ptest3.py
E:\utils>python ptest3.py
Traceback (most recent call last):
File "ptest3.py", line 1, in <module>
mgExit()
NameError: name 'mgExit' is not defined
First... of course the 2nd and 3rd calls (mgInit and mgExit) are going to fail without the first line when you invoke them all from "outside of python". To fix this "enter" the python interpreter first and then enter the three lines separately. To do that simply type "python" at the command line prompt and hit enter. When you do this you will enter the python interpreter. Then when you type commands here, they are kept together:
from mgapilib import *
mgInit(None,None)
mgExit()
it will work as you expect.
Second, it sounds like the "from mgapilib import *" command made all that crazy output. Is that correct? If so I cannot explain where that is coming from. Instead of the "from mgapilib import *" variant, can you try just "import mgapilib" and tell us if the same output is displayed?
running the import mgapi command from the interpreter also results in the output being generated, AND the interpreter is also exited.
So I moved up a directory level and tried it again (mgapi from the interpreter)
It works as expected - the command executes and back to the interpreter.
So I look for mg* files in the original folder, and nothing there:
E:\utils>dir mg* Volume in drive E is User Volume Serial Number is 0878-963A Directory of E:\utils File Not Found
Shifting the test script out of the original folder also seems to work OK:
E:\>python ptest.py I: OpenFlight API version 16.0.0. I: Loading plugin <OpenFlight Data Dictionary> from <C:/Presagis/Suite16/OpenFlight_API/bin_x64/release/fltdata.dll>... I: Site <FLTDATA> registered for plugin <OpenFlight Data Dictionary>. I: Plugin <OpenFlight Data Dictionary> loaded.
What the heck??
Without access to your computer I cannot begin to diagnose what is happening. Could python have found another mgapilib.py in the directory where you are running from? Could you have accidentally (or long ago and have forgotten about it) put a copy of mgapilib.py into the python installation folder? Again without looking around your computer, I have no idea how importing mgapilib can cause that crazy output. It almost looks like stuff that a plugin might be printing when it is initialized.
Hmmm....
Anyway, sounds like you've figured out a workaround. I don't think this is a problem within mgapilib.py or any of the other installed OF API files. Must be something strange with your python environment.
Just installed the latest API, and that has not solved the issue.
Oops. It seems the error has changed to not being able to locate the module. That seems like a python config issue.
Shawn
Porting things to a new PC, and my script/s are broken. New PC is windows 10. Trying to get standalone python working.
API files from v14.2 or thereabouts.
Here's the error after my import attempt:
System error: mgapilib not found!
Code:
Presagis vars:
MPI_INSTALL_DEFAULT=C:\Presagis
PRESAGIS_CREATOR=C:\Presagis\Suite16\Creator
PRESAGIS_CREATOR_16_0=C:\Presagis\Suite16\Creator
PRESAGIS_LICENSING=C:\Presagis
PRESAGIS_OPENFLIGHT_API=C:\Presagis\OpenFlight_API
PRESAGIS_OPENFLIGHT_SCRIPT=C:\Presagis\OpenFlight_API\bin\release
PRESAGIS_ROOT=C:\Presagis
PYTHONPATH=C:\Presagis\OpenFlight_API\bin\release
From the interpreter I can see:
E:\utils>python
Python 2.7.8 (default, Jun 30 2014, 16:08:48) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from mgapilib import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Presagis\OpenFlight_API\bin\release\mgapilib.py", line 7, in <module>
import _mgapilib
ImportError: DLL load failed: %1 is not a valid Win32 application.
Help!
Thx