How does sysconfig.get_config_vars() get config info...
Hi, I'm trying to cross compile a C extension - on a i686 linux box, targeting a ppc-linux box. get_config_vars(*args): global _config_vars if _config_vars is None: ... else: ... ... What I don't understand is, on the first invocation of get_config_vars(), _config_vars is not None - and how does it get populated. According to the comments, the makefile of the build (i686) python is read for the config info. However, since my os.name is Tho my system is "posix", I would expect _posix_init() to get invoked, but it doesn't. Dropped some prints in all the places where _config_vars is set, but none get triggered ... Since its picking up the build (i686) python config info somewhere, I'm hoping to intervenw and in this cross compile case, force it to use the makefile of the target (ppc) python... if only I knew where its being read in... I even renamed the build (i686) python makefile to see if I can observe an alternate codepath, but _config_vars still has the build (i686) python config info. If only I could get it to look at the target python config info, I can have it use the linker for the target and build the target .so... By using the $CC env option, I was able to have build (i686) python use my cross-gcc (ppc), so I can generate the .o's for the pcc target... need to just override the linker to use the cross-linker (ie cross-gcc itself)... Any help appreciated... Thanks much, /venkat -- http://mail.python.org/mailman/listinfo/python-list
Re: How to execute a linux command by python?
Fredrik Lundh wrote: > haishan chang wrote: > > > How to execute a linux command by python? > > for example: execute "ls" or "useradd oracle" > > Who can help me? > > start here: > > http://www.python.org/doc/lib/ > > After reading the matl. pointed to by the many links listed here, you can try pexpect. Provided for more control and interactivity. More at: http://pexpect.sourceforge.net/ /venkat -- http://mail.python.org/mailman/listinfo/python-list
How to disable tk inclusion in py build
Hi folks, I'd like to disable the inclusion of tk graphics lib in my py build. Looked around but couldn't find a clear answer. Which one of the following would I need to use in the configure step: --disable-tkbuild --without-tk Thanks, /venkat -- http://mail.python.org/mailman/listinfo/python-list
Re: How to disable tk inclusion in py build
Hi Fredrick, > since _tkinter.so is only built if it's found by the setup script, > and if built, it's only loaded if you actually use it, why bother > "disabling" it ? I don't want it to build tk into the py dist, even if it finds it on the build box - its not needed in the deployment. Keeping it out will make the deployed pkg leaner. Don't want end-users accessing it, since its not meant to be accessed. Thanks, /venkat -- http://mail.python.org/mailman/listinfo/python-list
Re: How to disable tk inclusion in py build
> I'd like to disable the inclusion of tk graphics lib in my py build. > Looked around but couldn't find a clear answer. Which one of > the following would I need to use in the configure step: > --disable-tkbuild > --without-tk In case anyone is intereted, as it turns out, one way of achieving this is to disable the following statement in python's setup.py: self.detect_tkinter(inc_dirs, lib_dirs) of def detect_modules(self): This will ignore the compilation of _tkinter.c and tkappinit.c of the python distribution. This will totally skip the detection and inclusion of tk/tcl into the "built-in" pkg, irrespective of its presence on the buildbox. This will also work in the case of cross-compile builds of python. In the cross-compile case, there is a likelihood of the build process attempting to pick tk/tcl lib files from the buildbox (platform) and using it wrongly for the different target platform. In addition, one would also have to skip the inclusion of the python2.x/Lib/lib-tk/*.py files in the final dist. Just this exclusion is not enuff, the earlier detection step change is also needed to prevent all the buildtime errors. Thanks, /venkat -- http://mail.python.org/mailman/listinfo/python-list
Possible problem in compiler/transformer.py of Python2.4...
Hi all, I have python2.4 running on ppc-linux 2.6.17. I'm attempting to get a TurboGears 0.9a9 (using CherryPy 2.2.1) based app running on it. During the TG-app startup sequence, it reaches the point where it imports cherrypy, which eventually causes py2.4's system file, compiler/transformer.py, to import a module by name, symbol. Unable to find it, python quits... Following are the error msgs: ... File "start-tg-app.py", line 24, in ? import cherrypy File "/usr/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/__init__.py", line 10, in ? import config File "/usr/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/config.py", line 8, in ? from cherrypy.lib import autoreload, cptools, httptools File "/usr/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/lib/cptools.py", line 252, in ? import compiler File "/usr/lib/python2.4/compiler/__init__.py", line 24, in ? from transformer import parse, parseFile File "/usr/lib/python2.4/compiler/transformer.py", line 30, in ? import symbol ImportError: No module named symbol ... What is surprising is I checkd the entire py2.4 distribution and I can't see a symbol.py (or a module with symbol defined) where transformer.py could import the symbol module form. All I can see is: ./lib/python2.4/compiler/symbols.py in the same directory as that of transformer.py (in compiler). Has anyone seen this error, or have any pointers to solve the problem. Thanks, /venkat -- http://mail.python.org/mailman/listinfo/python-list
how to specify path to .py modules during install...
Hi folks, On i686 Linux, I would like to place my python modules as: /src/py-modules/*.py and use the cmd from : ...base_dir]$ python src/py-modules/setup.py install --prefix=/usr so the .py files and the corresponding compiled .pyc files are at: /usr/lib/python2.4/site-packacges/*.py[c] Its unclear from the documentation, how I could specify the location of the *.py files, ie: /src/py-modules/ in the installation command: ...base_dir]$ python src/py-modules/setup.py install --prefix=/usr I can specify the destination of the module/compiled files, but how do I specify the the path to the .py files. I get the "file not found error". Of course, if I cd to: /src/py-modules/ and run the command, its able to find all the modules listed in setup.py:py_modules[.] entry. This is one among many other modules (C/py) being built while at the ... Thanks, /venkat -- http://mail.python.org/mailman/listinfo/python-list
Cross compile generation of .pyc from .py files...
Hi all, We've managed to cross-compile (from i686 targeting ppc) python (2.4.2) binaries and extension modules. However we cannot figure out how to cross-compile the .py (of distribution) files and generate the .pyc files for the target ppc from an i686 system. Is it possible to cross compile .pyc files from .py files? Some of the errors we get when we run 'python -v' on the target system include: # /usr/lib/python2.4/site.pyc has bad magic import site # from /usr/lib/python2.4/site.py # /usr/lib/python2.4/types.pyc has bad magic import types # from /usr/lib/python2.4/types.py . Thanks, /venkat -- http://mail.python.org/mailman/listinfo/python-list
Re: Cross compile generation of .pyc from .py files...
Terry Reedy wrote: > ... > I am under the impression that .pyc files are system independent. > Have you tried simply copying them over? > > tjr Hi Terry, It appears that python on the target ppc system is expecting to see ppc-related info in the .pyc files. These .pyc were generated at cross compile time (on i686 system) and packaged, deployed, installed on the ppc system. The "...has bad magic..." appears to indicate that ppc-version of python is expecting to see ppc-specific .pyc files, but is encountering i686-specific .pyc files... For some reason, the cross-compile step that results in the .pyc files is not generating them for the proper ppc-target, but is building them for the i686 system where they were being cross-compiled... Thanks, /venkat -- http://mail.python.org/mailman/listinfo/python-list
Re: Cross compile generation of .pyc from .py files...
Hi Sebastian, Thanks for that link and your notes. I was under the impression, that the .pyc files will be used (if found) by python to speed up execution of scripts... and so we packaged, deployed and installed the .py/.pyc files on to the ppc-target system. That package includes, site.py(c), types.py(c) etc., among others. Though I see these errors when I invokde 'python -v', I'm able to execute the .py files... but was hoping to use the .pyc files to benefit from the enhanced speed of execution. Like I mentioned to Terry, for some reason only the cross compile generation of .pyc for the ppc-target is not getting done right, whereas the actual ppc-specific python (2.4.2) binaries and extension (.so) modules are getting created properly. We were not trying to just ship the .pyc files and reverse-engineer the .py files from them on the target ppc system. Thanks, /venkat -- http://mail.python.org/mailman/listinfo/python-list
py web-app-frameworks without a rdbms...
Hi folks, Of TurboGers & Django WAF candidates, which one would be easier to use in an environment where the data/content doesn't come an RDBMS, but from other server-side apps... If these are not good candidates, could you suggest appropriate ones... TIA, /venkat -- http://mail.python.org/mailman/listinfo/python-list
Attempting to get lighttpd, fastcgi & python working
Hi folks, I'm trying to get lighttpd, fastcgi & python working on a 2.4.21.x i686 linux system. I tried following the steps in: http://www.cleverdevil.org/computing/24/python-fastcgi-wsgi-and-lighttpd Some of the lighttpd.conf setting are slightly different from those in that article - fixing some erros in the original and accounting for some change in entry formats itself. All components were built by 'root' and binaries run by 'root'. Python files (.py(c)) were deployed to '/site-packages' and run with execute prop turned on. I'm trying to run lighttpd on "dev-1686linux.my.org:8090" with the fastcgi server setup to listen on "127.0.0.1:8091". The problem I'm having is that though lighttpd comes up and is able to serve static content, it fails to bring up the WSGIServer and serve dynamic content (simple "Hello World") generated by the py script (test.pcgi). The errors I get are: [EMAIL PROTECTED] myApp]# lighttpd -f ./lighttpd.conf [EMAIL PROTECTED] myApp]# Traceback (most recent call last): File "/test/myApp/htdocs/test.fcgi", line 21, in ? WSGIServer(myapp, bindAddress = ("127.0.0.1", 8091)).run() File "/usr/lib/python2.4/site-packages/fcgi.py", line 1064, in run sock = self._setupSocket() Traceback (most recent call last): File "/test/myApp/htdocs/test.fcgi", line 21, in ? WSGIServer(myapp, bindAddress = ("127.0.0.1", 8091)).run() File "/usr/lib/python2.4/site-packages/fcgi.py", line 1027, in _setupSocket sock.bind(self._bindAddress) File "/usr/lib/python2.4/site-packages/fcgi.py", line 1064, in run sock = self._setupSocket() File "/usr/lib/python2.4/site-packages/fcgi.py", line 1027, in _setupSocket sock.bind(self._bindAddress) File "", line 1, in bind socket.error: (98, 'Address already in use') File "", line 1, in bind socket.error: (98, 'Address already in use') ... It is unclear why it thinks the 127.0.0.1:8091 sock is already in use. I ran this the first thing after a system reboot. No other apps are using this port. I see this error no matter what port I choose, on the server side. The browser sits there spinning and 'waiting' for the response to url that incudes the .pcgi script. The behviour is slightly different when I use UDSockets to listen on. Again, I can see static content. When I try the py script, I see it waiting indefinitely, but this time no errors are logged into the log file. So no clue where it is hanging on the server side. The access logs are not showing any "request" related entries even for the static content that is being deliverd (albeit properly). Can someone shed light on this. I thought if I can iron out this kink, then I can get TurboGears (CherryPy ws) working with lighttpd and fastcgi proxy-ing upfront. Searched around quite a bit, but unable to find a clue. Would much appreciate some pointers... Thanks a lot ... /venkat Following are the various config settings: /test/myApp/lightpd.conf: - server.modules = ( "mod_rewrite", "mod_access", "mod_fastcgi", "mod_accesslog" ) server.document-root = "/test/myApp/htdocs/" server.errorlog= "/var/tmp/lighttpd.error.log" index-file.names = ( "index.html", "index.htm" ) server.port= 8090 server.bind= "dev-1686linux.my.org" server.error-handler-404 = "/test.fcgi" fastcgi.server = ( ".fcgi" => ( ( "host" => "127.0.0.1", "port" => 8091, "bin-path" => "/test/myApp/htdocs/test.fcgi", "min-procs" => 1 ) ) ) /test/myApp/htdocs/test.fcgi: - #!/usr/bin/python2.4 # test.fcgi for myApp from fcgi import WSGIServer def myapp(environ, start_response): print 'got request: %s' % environ start_response('200 OK', [('Content-Type', 'text/plain')]) return ['Hello World!\n'] # use a tcp-socket based approach WSGIServer(myapp, bindAddress = ("127.0.0.1", 8091)).run() /test/myApp/fcgi.py: The WSCGIServer (fcgi.py) authored by Saddi is from: http://svn.saddi.com/py-lib/trunk/fcgi.py No mods here. -- http://mail.python.org/mailman/listinfo/python-list