![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,791
Rep Power: 5
![]() |
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') del __bootstrap__, __loader__ NameError: global name '__loader__' is not defined 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... |
|
|
|
|
|
#2 |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 4
![]() |
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 ?
|
|
|
|
|
|
#3 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,791
Rep Power: 5
![]() |
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. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Rule 3. Hacking | Intel17 | Community Announcements and Feedback | 3 | Jun 8th, 2006 4:05 PM |
| Update a Module | Dietrich | Python | 2 | Apr 29th, 2006 1:19 PM |
| Hacking. | BadBit | Coder's Corner Lounge | 63 | Nov 8th, 2005 2:58 AM |
| cgi module index.py?var=x how do i retrieve this w/o os module | cypherkronis | Python | 1 | Jul 3rd, 2005 1:10 PM |
| Build a Speech recognition module | bingoelzouhery | C# | 2 | May 24th, 2005 1:55 AM |