help running python in a limited interpreted environment

M

Mike

We have a large c++ program that runs under Windows NT Embedded to
control an instrument. That program has been written to run external
python scripts. The computer where this code runs does not and cannot
have a full python installation. It ONLY has the pythonNN.dll file
that comes with a full python installation.

For simple scripts that do not import external modules, this works just
fine.

For more complex scripts that require imported external modules, the
called modules (.py) have been placed on the computer in the same
folder as the calling script. However, when the calling scripts run,
we get the error message:

AttributeError: 'module' object has no attribute 'xxx'

We know the calling script finds the necessary modules, and the
attribute clearly appears in the module's .py file.

Can anyone tell me what the problem is or if what we're trying to do is
not possible? Is there something in addition to the .dll that needs to
be present?

Thanks.
 
N

Nick Coghlan

Mike said:
AttributeError: 'module' object has no attribute 'xxx'

We know the calling script finds the necessary modules, and the
attribute clearly appears in the module's .py file.

Can anyone tell me what the problem is or if what we're trying to do is
not possible? Is there something in addition to the .dll that needs to
be present?

Are there any circular imports in the scripts (e.g. A imports B which imports C
which imports A)? This error message is sometimes seen when attempting to access
attributes of a module which is still in the process of being imported.

There are a couple of bug reports on Source Forge about it - it hasn't been
fixed yet, mainly because it's a damn hard problem in need of a solution that is
still to be found ;)

The simplest resolution is to find a way to break the circularity (usually by
moving the code responsible for the circularity to a different - possibly new -
module)

If you don't have any circular imports, then I'm out of ideas :)

Cheers,
Nick.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top