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
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
Repository Revision Date User Message
ASF #332832 Sat Nov 12 20:11:59 UTC 2005 nlehuen Fix for MODPYTHON-88.
Files Changed
MODIFY /httpd/mod_python/trunk/test/htdocs/tests.py
MODIFY /httpd/mod_python/trunk/test/test.py
MODIFY /httpd/mod_python/trunk/Doc/appendixc.tex
MODIFY /httpd/mod_python/trunk/lib/python/mod_python/apache.py

Nicolas Lehuen added a comment - 13/Nov/05 05:12 AM
As Graham suggested, added sys.argv=['mod_python'] in apache.init().

Nicolas Lehuen made changes - 13/Nov/05 05:12 AM
Field Original Value New Value
Resolution Fixed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 3.2 [ 11060 ]
Nicolas Lehuen made changes - 13/Nov/05 05:13 AM
Affects Version/s 3.1.3 [ 11010 ]
Affects Version/s 2.7.10 [ 11011 ]
Affects Version/s 3.1.4 [ 11091 ]
Affects Version/s 3.3 [ 12310101 ]
Affects Version/s 3.2 [ 11060 ]
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...

Graham Dumpleton made changes - 05/Mar/06 02:43 PM
Status Resolved [ 5 ] Closed [ 6 ]