[Pythonmac-SIG] py2app generated app, not acting as a stand-alone app
Richard Rodriguez
gm770 at nyc.rr.com
Wed Nov 2 21:06:49 CET 2005
> On 2-nov-2005, at 20:38, Richard Rodriguez wrote:
>
>> "webdemo.py" opens a cgi server on a port, I'm using port 1770. It does
>> this by using: BaseHTTPServer.HTTPServer
>> This allows me to use a web browser, and open a python file, which is
>> generating HTML
>> A browser url would look like: http://localhost:1770/cgi-bin/
>> test_real3.py
>>
>> So I have 2+ files, "webdemo" and a html page generator "test_real3.py"
>> It seems as if the "webdemo" script, is using the corect "stand- alone"
>> version of python, but the python file that responds to the URL call,
>> seems to be looking in the wrong place. it's looking at the installed
>> Python, instead of the stand-alone Python. It could be a path problem
>> of some kind.
>
>
> You didn't quite answer my question :-). How does webdemo execute the
> code in test_real3.py? Does it import it as a module or execute it like a
> real CGI script?
>
> If you execute test_real3.py as a separate process your setup.py doesn't
> work. Py2app copies just enough of /Libary/Framework/ Python.framework to
> supply the dependencies of the script named in setup.py (e.g.
> webdemo.py), and therefore might not include modules imported by
> test_real3.py. I'm amazed that py2app even bothers to include bin/python.
> It definitely does not rewrite the paths to shared libraries used by
> bin/python.
>
> Ronald
>
I guess it executes it "like a real CGI script". The code in "webdemo"
never calls any of the html python pages. webdemo starts a server on port
1770, opens a browser to a page linking to a python html page, and waits for
any calls to port 1770. when the browser gets a call to port 1770, it can
run a python script, and display the output, which could be formated html.
>>
>>
>> ----- Original Message ----- From: "Ronald Oussoren"
>> <ronaldoussoren at mac.com>
>> To: "Richard Rodriguez" <gm770 at nyc.rr.com>
>> Cc: <pythonmac-sig at python.org>
>> Sent: Wednesday, November 02, 2005 2:14 PM
>> Subject: Re: [Pythonmac-SIG] py2app generated app,not acting as a
>> stand-alone app
>>
>>
>>>
>>> On 2-nov-2005, at 4:24, Richard Rodriguez wrote:
>>>
>>>> I created a python cgi-server, and generate web pages with python.
>>>> After getting past the main mac issues, I'm down to the last 1, a
>>>> stand-alone app. My "py2app" generated app works, except that it is
>>>> looking at the installed python for something. I didn't notice until
>>>> I tried on a mac without python, and after renaming the folder where
>>>> I have python installed.
>>>
>>> What does webdemo.py do? Does it execute test_real3.py in a seperate
>>> process (using os.popen or something like that)?
>>>
>>> Ronald
>>>
>>>>
>>>> here's my error:
>>>> localhost - - [01/Nov/2005 13:00:06] dyld: /Users/mayu/Desktop/
>>>> dist_win_10_25_05/webdemo.app/Contents/Frameworks/ Python.framework/
>>>> Versions/2.4/bin/python
>>>> can't open library: /Library/Frameworks/Python.framework/ Versions/
>>>> 2.4/Python (No such file or directory, errno = 2)
>>>>
>>>> The library it's trying to open is the version installed locally,
>>>> when it should be looking at the library inside "webdemo.app". Most
>>>> likly a path problem.
>>>> My guess is that I can fix this by modifying my py2app setup script,
>>>> but don't understand how.
>>>> Any help would be great.
>>>>
>>>>
>>>> Below is the rest of my setup and errors:
>>>> ------ file info ------
>>>> "webdemo.app" - the cgi web-server
>>>> cgi-bin/test_real3.py - generates html page
>>>> /Library/Frameworks/Python.framework - this is the locally
>>>> installed python
>>>> /Users/mayu/Desktop/dist_win_10_25_05/ - this is where the py2app
>>>> generated mac app is located
>>>>
>>>> ------- my simple setup script for py2app ----------
>>>> # setup.py
>>>> from distutils.core import setup
>>>> import py2app
>>>> setup(app=["webdemo.py"])
>>>>
>>>> ------- full list of console messages ----------
>>>> serving at port 1770
>>>> localhost - - [01/Nov/2005 13:00:05] "GET /cgi-bin/test_real3.py
>>>> HTTP/1.1" 200 -
>>>> localhost - - [01/Nov/2005 13:00:05] Trying to execute scriptfile
>>>> /Users/mayu/Desktop/dist_win_10_25_05/webdemo.app/Contents/
>>>> Resources/cgi-bin/test_real3.py
>>>> localhost - - [01/Nov/2005 13:00:05] command:
>>>> /Users/mayu/Desktop/dist_win_10_25_05/webdemo.app/Contents/
>>>> Frameworks/Python.framework/Versions/2.4/bin/python
>>>> -u /Users/mayu/Desktop/dist_win_10_25_05/webdemo.app/Contents/
>>>> Resources/cgi-bin/test_real3.py
>>>> ""
>>>> localhost - - [01/Nov/2005 13:00:06] dyld:
>>>> /Users/mayu/Desktop/dist_win_10_25_05/webdemo.app/Contents/
>>>> Frameworks/Python.framework/Versions/2.4/bin/python
>>>> can't open library:
>>>> /Library/Frameworks/Python.framework/Versions/2.4/Python (No such
>>>> file or directory, errno = 2)
>>>> localhost - - [01/Nov/2005 13:00:06] CGI script exited OK
>>>>
>>>> _______________________________________________
>>>> Pythonmac-SIG maillist - Pythonmac-SIG at python.org
>>>> http://mail.python.org/mailman/listinfo/pythonmac-sig
>>
>
More information about the Pythonmac-SIG
mailing list