[mod_python] Re: PyChart into web site error

G.M.Dall'Olio dalloliogm at gmail.com
Wed Oct 19 07:32:48 EDT 2005


Hi all, I'm getting this error from mod_python, when I try to use 
PyChart to create a simple chart:

Traceback (most recent call last):

  File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 299, in HandlerDispatch
    result = object(req)

  File "/usr/lib/python2.4/site-packages/mod_python/publisher.py", line 136, in handler
    result = util.apply_fs_data(object, req.form, req=req)

  File "/usr/lib/python2.4/site-packages/mod_python/util.py", line 361, in apply_fs_data
    return object(**args)

  File "/home/motif/public_html/Exp/PyChart/index.py", line 8, in home
    chart = plot1.plot2()

  File "/home/motif/public_html/Exp/PyChart/plot1.py", line 57, in plot2
    return ar.draw()

  File "/usr/lib/python2.4/site-packages/pychart/area.py", line 188, in draw
    can = canvas.default_canvas()

  File "/usr/lib/python2.4/site-packages/pychart/canvas.py", line 73, in default_canvas
    return init(None)

  File "/usr/lib/python2.4/site-packages/pychart/canvas.py", line 58, in init
    can = pscanvas.T(fname)

  File "/usr/lib/python2.4/site-packages/pychart/pscanvas.py", line 25, in __init__
    basecanvas.T.__init__(self)

  File "/usr/lib/python2.4/site-packages/pychart/basecanvas.py", line 70, in __init__
    self.title = re.sub("(.*)\\.py$", "\\1", sys.argv[0])

AttributeError: 'module' object has no attribute 'argv'


I've searched with google and found that this topic has been already 
addressed on this list, but still there is not solution. I've asked to 
the author of the original post and he has resolved using spyce instead 
of mod_python, but since I'm a newbie of mod_python, I would like to 
continue with it.
Since the script works on the command line, probably it may be some 
security setting in mod_python that restricts access to certain modules, 
but I can't understand how to change this.
The python code in plot1.py is this:

from pychart import *
def plot2():

        data = [["Jan", 10], ["Feb", 22], ["Mar", 30]]

        ar = area.T(x_coord = category_coord.T(data, 0),
        y_range = (0, None),
        x_axis = axis.X(),
        y_axis = axis.Y())
        ar.add_plot(bar_plot.T(data = data, label = "Something"))

        return ar.draw()

and the Directive in Apache configuration is this:

<Directory /home/motif/public_html/>
    AllowOverride FileInfo
    AddHandler mod_python .py
    PythonHandler mod_python.publisher
    PythonDebug On
</Directory>

It's about a month that I'm trying to resolve this... Can someone give 
me some hints? Why mod_python requires sys.argv? Is this a problem only 
of italian peoples? ;)
Thank you...


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20051019/3bf1534e/attachment.html


More information about the Mod_python mailing list