From: Peter G. <pgr...@ge...> - 2004-07-09 01:26:41
|
You can always do this by adding: SetEnv PYTHONPATH /locations/of/packages/want/to/import/ to your apache config file. -- Peter Groszkowski Gemini Observatory Tel: +1 808 974-2509 670 N. A'ohoku Place Fax: +1 808 935-9235 Hilo, Hawai'i 96720, USA Rodrigo Caballero wrote: > I did some python CGI scripting at one point, and I needed to do > something like > > os.environ['MATPLOTLIBDATA'] = '/where/matplotlib/lives' > > before the matplotlib import ... hope that helps, > > rodrigo > > --- > > Rodrigo Caballero Augi (http://geosci.uchicago.edu/~rca) > Research Associate > Department of the Geophysical Sciences, University of Chicago > 5734 South Ellis Avenue, Chicago, IL 60637, USA. > > > On Thursday, July 8, 2004, at 06:26 PM, Jonathan Hanson wrote: > >> I'm having issues importing matplotlib into my python script, but >> only when runing under PHP. >> >> The line: >> from matplotlib import * >> >> causes my .py script to return an error code "1" when being called >> from inside a PHP script. However, the script runs just fine when >> called from the command line. >> >> If i comment out the above line and all the matplotlib-related >> commands in my script, it will run just fine (but without plots of >> course). But the include command alone is enough to cause an error 1 >> return. >> >> I have been through every documentation source I can find, I've tried >> every variation of import i can think of, and I've come up with a big >> fat 0. I've tried something like: >> sys.path.append("/usr/lib/python2.3/site-packages/matplotlib") >> after the sys import and before the matplotlib import thinking there >> was a path issue with the apache user, and got jack squat out of that. >> >> Has anyone else had issues calling python scripts from inside PHP? >> All my other imports below: >> # Module Imports >> from optparse import OptionParser >> import sys >> #from matplotlib import * >> from os import listdir >> from string import split >> from array import array >> from time import time#, ctime >> >> work just fine. I've been on this for 3 solid days, someone either >> shoot me or help me! Thanks. >> >> >> ------------------------------------------------------- >> This SF.Net email sponsored by Black Hat Briefings & Training. >> Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital >> self defense, top technical experts, no vendor pitches, unmatched >> networking opportunities. Visit www.blackhat.com >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > > > > ------------------------------------------------------- > This SF.Net email sponsored by Black Hat Briefings & Training. > Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital > self defense, top technical experts, no vendor pitches, unmatched > networking opportunities. Visit www.blackhat.com > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |