![]() |
Hacking Around With Module Imports
Sorry about all these questions, but there's really very little resources on the Internet for such obscure things as these... I'm pretty helpless again.
Here goes: I'm running some Python CGI scripts on a virtual server, which I don't have total control over. It has Python 2.4 installed, but it does not have MySQLdb installed. Since the Python directory has limited write permission, I can not install modules on the server's Python. I managed to hack around this by simply placing the contents of the folder "MySQLdb" in the same directory as the script I'm running. However, the next problem is my script needs "setuptools", another Python module, installed. But this is where the problem arises. I try the same method: put the source files in the same folder as the script. However, in one of the files of "setuptools" I get this error: :
__file__ = pkg_resources.resource_filename(__name__,'_mysql.pyd')Which is apparently the error for when setuptools is not properly installed. I tried a different method: install it locally, go into lib/site-packages/setuptools-0.6c7-py2.4.egg, and place that in the same directory as the CGI scripts. However, still the same error.Is there any other way I could fake an install of a module without installing it directly to the Python 2.4 folder? I need a way to use the "pkg_resources.py" file from setuptools in my CGI script... |
Re: Hacking Around With Module Imports
Have you tried putting the setuptools egg in a directory, and then appending the directory's path to sys.path ?
|
Re: Hacking Around With Module Imports
Thanks. I've tried that now, but I still get the same error.
I know what I did wrong now... when I built setuptools, it was built for win32. The server is Linux. I'll need to build it from source on my Linux machine at work, then try uploading it from there. |
| All times are GMT -5. The time now is 1:13 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC