Mechanism how openWNS finds the PyConfig modules

Asked by Jan

I was wondering how the openwns binary finds the python modules under sandbox/dbg/lib/PyConfig/

When I run openwns under MacOS the modules are only found and correctly imported if I add the above-mentioned directory to the PYTHONPATH environment variable. On the Linux systems this somehow works automatically - could someone please explain the mechanism so that I can fix this on the Mac?

Thanks
Jan

Question information

Language:
English Edit question
Status:
Solved
For:
openWNS SDK Edit question
Assignee:
No assignee Edit question
Solved by:
Marc Schinnenburg
Solved:
Last query:
Last reply:
Revision history for this message
Best Marc Schinnenburg (marc.schinnenburg) said :
#1

Hi Jan,

the relevant statement is here (line 195):

http://bazaar.launchpad.net/~comnets/openwns-library/library--main--1.0/annotate/head%3A/src/simulator//Application.cpp

> configuration_.appendPath(getPathToPyConfig());

You may need to tweak the getPathToPyConfig() method.

ATM, it assumes '/proc/self/exe' is a link to the openwns executable. It
uses 'readlink' to find the "real path" to openwns. It assumes PyConfig
is located at '"real path"/../lib/PyConfig' and returns this as path to
PyConfig.

Since there is no /proc on MacOS you may need to use
_NSGetExecutablePath() or something similar. See here:
http://developer.apple.com/DOCUMENTATION/DARWIN/Reference/ManPages/man3/dyld.3.html

Regards,
        Marc

Revision history for this message
Daniel Bültmann (daniel.bueltmann) said :
#2

Dear Jan,

did this solve your question? If yes, could you indicate this by changing the status to "Solved"?

Regards,
  Daniel

Revision history for this message
Jan (jan-ellenbeck) said :
#3

Thanks Marc Schinnenburg, that solved my question.