Issue Details (XML | Word | Printable)

Key: MODPYTHON-88
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Unassigned
Reporter: Graham Dumpleton
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
mod_python

Initialise sys.argv to a dummy value.

Created: 11/Nov/05 02:00 PM   Updated: 05/Mar/06 02:43 PM
Return to search
Component/s: core
Affects Version/s: 2.7.10, 3.1.3, 3.1.4, 3.2.7
Fix Version/s: 3.2.7

Time Tracking:
Not Specified

Resolution Date: 13/Nov/05 05:12 AM


 Description  « Hide
As mod_python isn't executed as part of a traditional command line program but is embedded into Apache, there is no actual sys.argv array for command line parameters. This though causes problems when certain third party modules are used which want for some reason to query sys.argv, eg. numarray:

  http://www.modpython.org/pipermail/mod_python/2005-October/019401.html

and pychart:

  http://www.modpython.org/pipermail/mod_python/2005-October/019360.html

Simple way of avoiding this would be if apache.init() method executed for each interpreter being created set sys.argv.

   sys.argv = ['mod_python']


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Nicolas Lehuen added a comment - 13/Nov/05 05:12 AM
As Graham suggested, added sys.argv=['mod_python'] in apache.init().

Nicolas Lehuen added a comment - 13/Nov/05 05:19 AM
Note that pychart is particularly weird, since not only it looks inside sys.argv, but it also requires a value to be passed (it uses sys.argv[0]) ! Talk about reusability...