[Pythonmac-SIG] [py2app] No module named os

Chris Weisiger cweisiger at msg.ucsf.edu
Sat Sep 11 00:06:21 CEST 2010


Whelp, this problem is back, with a different program this time. All the
fixes I have written down from last time don't work. Fortunately this time I
don't have any dependencies on weird homegrown libraries that require hours
of fiddling -- just on wx, paramiko, and Crypto.

To recap: py2app generates an application successfully. Per my post earlier
today (
http://old.nabble.com/py2app-program-unable-to-find-files-in-lib-dynload-td29679814.html),
I then hack __boot__.py to modify sys.path so it can find SHA256.so.
The
program runs just fine on my development computer. I take it over to a
client computer and try to run it. It tries 'import os' and fails.

Last time I speculated that this was due to stale pyc files hanging around.
I've removed all pyc files from the app and it still fails, so that's not
what's going wrong here. Without access to os, I can't check environment
variables, let alone change them. Frankly I don't have a clue how to debug
this short of random flailings -- and I spent three days or so on that last
time before stumbling across something that worked. Comparing that working
program to this nonworking program hasn't turned up any obvious
discrepancies, though.

Anyway, my source code is online here:

http://derakon.dyndns.org/~chriswei/temp2/processor.tgz

If you have any insight into this problem, I'd love to hear it.

-Chris

On Mon, Aug 23, 2010 at 4:55 PM, Dan Ross <dan at rosspixelworks.com> wrote:

> Happy to try.
>
> Glad you got it sorted out.
>
>
>
> On Mon, 23 Aug 2010 15:39:17 -0700, Chris Weisiger <cweisiger at msg.ucsf.edu>
> wrote:
>
> That's odd. I get the "couldn't load module(s): P" but Y loads fine. These
> are legacy modules from a previous developer, and I generally try to avoid
> dealing with them. "Y" refers to either "usefulX.py" or "usefulX2.py", I'm
> not certain which. Both are in the Priithon directory. (Note that they
> aren't imported as "X" because that's the letter used for one of the modules
> the original developer named after himself...fortunately not in this
> particular program)
>
> However, I was able to get a standalone version working. I started poking
> at the __boot__.py and site.py files in the generated app, and somehow that
> made the failures to import fundamental libraries like os and traceback go
> away. My only guess is that maybe py2app was including the .pyc files that
> had been generated on my local computer? Anyway, after that I got failures
> to import numpy.Tester, which are I think due to a version mismatch on my
> end. Easily fixed, though, as that module's not actually needed; I just
> commented out the imports.
>
> Thanks for being willing to take a look! I think maybe I just needed a
> weekend of not thinking about it so I could come back to the problem fresh.
> :)
>
> -Chris
>
> On Mon, Aug 23, 2010 at 3:26 PM, Dan Ross <dan at rosspixelworks.com> wrote:
>
>> Hmmm.....
>>
>> I'm getting this when I try to run it from Terminal:
>>
>> dan-rosss-macbook-pro:editor dan$ python editor.py
>>  * couldn't load module(s):    Y  P
>>
>> Traceback (most recent call last):
>>   File "editor.py", line 7, in
>>     import mainapp
>>   File "/Users/dan/Desktop/editor/mainapp.py", line 2, in
>>     import demoframe
>>   File "/Users/dan/Desktop/editor/demoframe.py", line 6, in
>>     import imeditpanel
>>   File "/Users/dan/Desktop/editor/imeditpanel.py", line 12, in
>>     import realign
>>   File "/Users/dan/Desktop/editor/realign.py", line 8, in
>>     from Priithon.all import F, Y
>> ImportError: cannot import name Y
>>
>>
>> Can you tell me what's supposed to be happening?
>>
>> On 8/23/10 10:18 AM, Chris Weisiger wrote:
>>
>> I've put the program online here:
>>
>> http://derakon.dyndns.org/~chriswei/temp2/editor.tgz<http://derakon.dyndns.org/%7Echriswei/temp2/editor.tgz>
>>
>> When run, it should show a large blank window with four icons in the
>> upper-left corner.
>>
>> Thanks for being willing to take a look.
>>
>> -Chris
>>
>> On Sat, Aug 21, 2010 at 6:12 AM, Dan Ross <dan at rosspixelworks.com> wrote:
>>
>>> Hey Chris-
>>>
>>> Is the source available anywhere? I've made a few wx apps and that sounds
>>> familiar.
>>>
>>> Dan
>>>
>>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20100910/e0016e24/attachment.html>


More information about the Pythonmac-SIG mailing list