[web2py] How to start server from within a python file ?
hello, I just tried to run Web2Py_CC, (that's the best name I could think of for my editor ;-) on Ubuntu and Fedora, and most of the things works quit well. One of the problems I encounter is launching of the web2py server. Launching the server under windows works perfect through the web2py exe-file) For launching the server in Linux, from within a python program, the only thing I can think of, is the use of execfile(). As I run web2py.py from the command line, it runs ok. The following program, doesn't work filename = r'P:/Web2Py/web2py_src/web2py/web2py.py' import os os.chdir ( os.path.split ( filename)[0] ) print os.getcwd() execfile ( filename ) and gives the following error message: Traceback (most recent call last): File "D:\Data_Python_25\support\test.py", line 21, in execfile ( filename ) File "P:/Web2Py/web2py_src/web2py/web2py.py", line 16, in import gluon.import_all ImportError: No module named gluon.import_all Now if I add the web2py path to the python system path, I get the following error (it looks to me that the web2py_path is not very well derived) Traceback (most recent call last): File "D:\Data_Python_25\support\test.py", line 26, in execfile ( filename ) File "P:/Web2Py/web2py_src/web2py/web2py.py", line 17, in import gluon.widget File "P:/Web2Py/web2py_src/web2py\gluon\widget.py", line 28, in import main File "P:/Web2Py/web2py_src/web2py\gluon\main.py", line 63, in version_info = open(os.path.join(web2py_path, 'VERSION'), 'r') IOError: [Errno 2] No such file or directory: 'D:\\Data_Python_25\\support\\VERSION' If try subprocess.Popen, import subprocess Params = 'python ' + filename + ' -i localhost -v -D 0 -a "aap"' subprocess.Popen ( Params ) I get the following error: web2py Enterprise Web Framework Created by Massimo Di Pierro, Copyright 2007-2010 Version 1.81.5 (2010-07-22 23:56:21) Database drivers available: pysqlite2, MSSQL/DB2 Starting hardcron... DEBUG:root:WEB2PY CRON: Acquiring lock DEBUG:root:WEB2PY CRON: Releasing cron lock please visit: http://localhost:8000INFO:root:Hard cron daemon started use "kill -SIGTERM 2024" to shutdown the web2py server INFO:root:starting web server... INFO:root:SSL is off INFO:root:SSL is off DEBUG:Rocket.Errors.ThreadPool:Initializing ThreadPool. INFO:Rocket.Errors.ThreadPool:Starting Rocket 1.0.6 DEBUG:Rocket.Errors.ThreadPool:This platform does not support signals. DEBUG:Rocket.Errors.ThreadPool:Starting threads. DEBUG:Rocket.Errors.Thread-4:Entering main loop. DEBUG:Rocket.Errors.Thread-5:Entering main loop. DEBUG:Rocket.Errors.Thread-10:Entering main loop. DEBUG:Rocket.Errors.Thread-6:Entering main loop. DEBUG:Rocket.Errors.Thread-11:Entering main loop. DEBUG:Rocket.Errors.Thread-12:Entering main loop. DEBUG:Rocket.Errors.Thread-3:Entering main loop. DEBUG:Rocket.Errors.Thread-8:Entering main loop. DEBUG:Rocket.Errors.Thread-7:Entering main loop. DEBUG:Rocket.Errors.Thread-9:Entering main loop. DEBUG:Rocket.Monitor:Entering monitor loop. DEBUG:Rocket.Monitor:In "receive timed-out connections" loop. INFO:Rocket.Errors.ThreadPool:Listening on sockets: localhost:8000 INFO:Rocket.Errors.ThreadPool:Stopping Server DEBUG:Rocket.Errors.ThreadPool:Stopping threads. DEBUG:Rocket.Monitor:Received a death threat. DEBUG:Rocket.Errors.Thread-6:Received a death threat. DEBUG:Rocket.Errors.Thread-5:Received a death threat. DEBUG:Rocket.Errors.Thread-8:Received a death threat. DEBUG:Rocket.Monitor:Flushing waiting connections DEBUG:Rocket.Errors.Thread-3:Received a death threat. DEBUG:Rocket.Errors.Thread-9:Received a death threat. DEBUG:Rocket.Errors.Thread-11:Received a death threat. DEBUG:Rocket.Errors.Thread-10:Received a death threat. DEBUG:Rocket.Errors.Thread-12:Received a death threat. DEBUG:Rocket.Errors.Thread-7:Received a death threat. DEBUG:Rocket.Errors.Thread-4:Received a death threat. DEBUG:Rocket.Monitor:Flushing queued connections DEBUG:Rocket.Errors.ThreadPool:Removing dead thread: Thread-4. DEBUG:Rocket.Errors.ThreadPool:Removing dead thread: Thread-5. DEBUG:Rocket.Errors.ThreadPool:Removing dead thread: Thread-10. DEBUG:Rocket.Errors.ThreadPool:Removing dead thread: Thread-6. DEBUG:Rocket.Errors.ThreadPool:Removing dead thread: Thread-11. DEBUG:Rocket.Errors.ThreadPool:Removing dead thread: Thread-3. DEBUG:Rocket.Errors.ThreadPool:Removing dead thread: Thread-12. DEBUG:Rocket.Errors.ThreadPool:Removing dead thread: Thread-8. DEBUG:Rocket.Errors.ThreadPool:Removing dead thread: Thread-7. DEBUG:Rocket.Errors.ThreadPool:Removing dead thread: Thread-9. any sugestions ? thanks, Stef Mientki
Re: [web2py] How to start server from within a python file ?
It's very nice to see you using linux. If you have any questions that are linux related please tell me and I can try to help you. :D BR, Jason Brower On Sun, 2010-08-22 at 22:03 +0200, Stef Mientki wrote: > hello, > > I just tried to run Web2Py_CC, (that's the best name I could think of for my > editor ;-) > on Ubuntu and Fedora, and most of the things works quit well. > One of the problems I encounter is launching of the web2py server. > > Launching the server under windows works perfect through the web2py exe-file) > For launching the server in Linux, > from within a python program, > the only thing I can think of, > is the use of execfile(). > > As I run web2py.py from the command line, it runs ok. > > The following program, doesn't work > filename = r'P:/Web2Py/web2py_src/web2py/web2py.py' > import os > os.chdir ( os.path.split ( filename)[0] ) > print os.getcwd() > execfile ( filename ) > > and gives the following error message: > Traceback (most recent call last): > File "D:\Data_Python_25\support\test.py", line 21, in > execfile ( filename ) > File "P:/Web2Py/web2py_src/web2py/web2py.py", line 16, in > import gluon.import_all > ImportError: No module named gluon.import_all > > Now if I add the web2py path to the python system path, I get the following > error > (it looks to me that the web2py_path is not very well derived) > Traceback (most recent call last): > File "D:\Data_Python_25\support\test.py", line 26, in > execfile ( filename ) > File "P:/Web2Py/web2py_src/web2py/web2py.py", line 17, in > import gluon.widget > File "P:/Web2Py/web2py_src/web2py\gluon\widget.py", line 28, in > import main > File "P:/Web2Py/web2py_src/web2py\gluon\main.py", line 63, in > version_info = open(os.path.join(web2py_path, 'VERSION'), 'r') > IOError: [Errno 2] No such file or directory: > 'D:\\Data_Python_25\\support\\VERSION' > > If try subprocess.Popen, > import subprocess > Params = 'python ' + filename + ' -i localhost -v -D 0 -a "aap"' > subprocess.Popen ( Params ) > > I get the following error: > web2py Enterprise Web Framework > Created by Massimo Di Pierro, Copyright 2007-2010 > Version 1.81.5 (2010-07-22 23:56:21) > Database drivers available: pysqlite2, MSSQL/DB2 > Starting hardcron... > DEBUG:root:WEB2PY CRON: Acquiring lock > DEBUG:root:WEB2PY CRON: Releasing cron lock > please visit: > http://localhost:8000INFO:root:Hard cron daemon started > > use "kill -SIGTERM 2024" to shutdown the web2py server > INFO:root:starting web server... > INFO:root:SSL is off > INFO:root:SSL is off > DEBUG:Rocket.Errors.ThreadPool:Initializing ThreadPool. > INFO:Rocket.Errors.ThreadPool:Starting Rocket 1.0.6 > DEBUG:Rocket.Errors.ThreadPool:This platform does not support signals. > DEBUG:Rocket.Errors.ThreadPool:Starting threads. > DEBUG:Rocket.Errors.Thread-4:Entering main loop. > DEBUG:Rocket.Errors.Thread-5:Entering main loop. > DEBUG:Rocket.Errors.Thread-10:Entering main loop. > DEBUG:Rocket.Errors.Thread-6:Entering main loop. > DEBUG:Rocket.Errors.Thread-11:Entering main loop. > DEBUG:Rocket.Errors.Thread-12:Entering main loop. > DEBUG:Rocket.Errors.Thread-3:Entering main loop. > DEBUG:Rocket.Errors.Thread-8:Entering main loop. > DEBUG:Rocket.Errors.Thread-7:Entering main loop. > DEBUG:Rocket.Errors.Thread-9:Entering main loop. > DEBUG:Rocket.Monitor:Entering monitor loop. > DEBUG:Rocket.Monitor:In "receive timed-out connections" loop. > INFO:Rocket.Errors.ThreadPool:Listening on sockets: localhost:8000 > INFO:Rocket.Errors.ThreadPool:Stopping Server > DEBUG:Rocket.Errors.ThreadPool:Stopping threads. > DEBUG:Rocket.Monitor:Received a death threat. > DEBUG:Rocket.Errors.Thread-6:Received a death threat. > DEBUG:Rocket.Errors.Thread-5:Received a death threat. > DEBUG:Rocket.Errors.Thread-8:Received a death threat. > DEBUG:Rocket.Monitor:Flushing waiting connections > DEBUG:Rocket.Errors.Thread-3:Received a death threat. > DEBUG:Rocket.Errors.Thread-9:Received a death threat. > DEBUG:Rocket.Errors.Thread-11:Received a death threat. > DEBUG:Rocket.Errors.Thread-10:Received a death threat. > DEBUG:Rocket.Errors.Thread-12:Received a death threat. > DEBUG:Rocket.Errors.Thread-7:Received a death threat. > DEBUG:Rocket.Errors.Thread-4:Received a death threat. > DEBUG:Rocket.Monitor:Flushing queued connections > DEBUG:Rocket.Errors.ThreadPool:Removing dead thread: Thread-4. > DEBUG:Rocket.Errors.ThreadPool:Removing dead thread: Thread-5. > DEBUG:Rocket.Errors.ThreadPool:Removing dead thread: Thread-10. > DEBUG:Rocket.Errors.ThreadPool:Removing dead thread: Thread-6. > DEBUG:Rocket.Errors.ThreadPool:Removing dead thread: Thread-11. > DEBUG:Rocket.Errors.ThreadPool:Removing dead thread: Thread-3. > DEBUG:Rocket.Errors.ThreadPool:Removing dead thread: Thread-12. > DEBUG:Rocket.Errors.ThreadPool:Removing dead thread: Thread-8. > DEBUG:Rocket.Errors.ThreadPool:Removing dead thread: Thread-7. > DEBUG:Rocket.Errors.ThreadPool:Removing dead thread: Thread-9. > > any suges
Re: [web2py] How to start server from within a python file ?
that's great Jason, On 23-08-2010 05:22, Jason Brower wrote: > It's very nice to see you using linux. If you have any questions that > are linux related please tell me and I can try to help you. :D ok here is the first problem What's the way to start the web2py server from a python script ? thanks, Stef > BR, > Jason Brower > > On Sun, 2010-08-22 at 22:03 +0200, Stef Mientki wrote: >> hello, >>
Re: [web2py] How to start server from within a python file ?
Hi Stef, you are using device names and backslashes (they are not understood by unix the same way windows does), could be that? http://en.wikipedia.org/wiki/Filename mic > and gives the following error message: > Traceback (most recent call last): > File "D:\Data_Python_25\support\test.py", line 21, in > execfile ( filename ) > File "P:/Web2Py/web2py_src/web2py/web2py.py", line 16, in > import gluon.import_all > ImportError: No module named gluon.import_all 2010/8/23 Stef Mientki : > that's great Jason, > > On 23-08-2010 05:22, Jason Brower wrote: >> It's very nice to see you using linux. If you have any questions that >> are linux related please tell me and I can try to help you. :D > ok here is the first problem > > What's the way to start the web2py server from a python script ? > > thanks, > Stef > >> BR, >> Jason Brower >> >> On Sun, 2010-08-22 at 22:03 +0200, Stef Mientki wrote: >>> hello, >>> > >
Re: [web2py] How to start server from within a python file ?
thanks Mic, but that's not the problem ( I changed them in single forward slashes), the problem is the file structure of web2py, I'm definitely missing something there. cheers, Stef On 23-08-2010 21:46, Michele Comitini wrote: > Hi Stef, > you are using device names and backslashes (they are not understood > by unix the same way windows does), could be that? > > http://en.wikipedia.org/wiki/Filename > > mic >> and gives the following error message: >> Traceback (most recent call last): >> File "D:\Data_Python_25\support\test.py", line 21, in >> execfile ( filename ) >> File "P:/Web2Py/web2py_src/web2py/web2py.py", line 16, in >> import gluon.import_all >> ImportError: No module named gluon.import_all > 2010/8/23 Stef Mientki : >> that's great Jason, >> >> On 23-08-2010 05:22, Jason Brower wrote: >>> It's very nice to see you using linux. If you have any questions that >>> are linux related please tell me and I can try to help you. :D >> ok here is the first problem >> >> What's the way to start the web2py server from a python script ? >> >> thanks, >> Stef >> >>> BR, >>> Jason Brower >>> >>> On Sun, 2010-08-22 at 22:03 +0200, Stef Mientki wrote: hello, >>