[mod_python] Getting error as The system cannot find the file specified

rahul.warhekar at edisphere.com rahul.warhekar at edisphere.com
Tue Mar 31 07:27:43 EDT 2009


hi graham

I just got entire trace please have a look at it

Mod_python error: "PythonHandler mod_python.psp"

Traceback (most recent call last):

  File "C:\Python24\lib\site-packages\mod_python\apache.py", line 299, in
HandlerDispatch
    result = object(req)

  File "C:\Python24\lib\site-packages\mod_python\psp.py", line 302, in
handler
    p.run()

  File "C:\Python24\lib\site-packages\mod_python\psp.py", line 213, in run
    exec code in global_scope

  File "C:/wamp/www/edi/modules/reports/index.psp", line 43, in ?

WindowsError: [Errno 2] The system cannot find the file specified



my index.psp contents are,


<%
import os
from mod_python import Session
from mod_python import util
from mod_python import psp
_REQUEST = util.FieldStorage(req)
view = "reports"
user =''
session.load()
try:
	user = session['user']
	user_name = session['user']
except KeyError,e:
	util.redirect(req,"/edi/login.psp")
try:
	new=session['my_filter']
except KeyError,e:
	util.redirect(req,"/edi/login.psp")


if view=='reports':
	util.redirect(req,'/edi/modules/reports/index.psp?hidval=f&showcnt=25&user=%s'%session['user'])
else:
	req.write("Invalid User")

%>


I have nothing on my line no 43.

Rahul

> 2009/3/31  <rahul.warhekar at edisphere.com>:
>> Traceback is:-
>>
>> Mod_python error: "PythonHandler mod_python.psp"
>>
>> File C:/wamp/www/edi/modules/reports/index.psp in line no 43
>> WindowsError: [Errno 2] The system cannot find the file specified
>>
>> I have this much traceback only with me. Any idea depending on this.
>
> The only remaining suggestion I have then is to check that the user
> that the Apache service runs as has the necessary privileges to access
> the directories/files that make up your project.
>
> Also calculate exactly what line 43 is in the file. I don't believe
> you have identified this to us. If there is no line 43, then it is
> possibly identifying the line in the generate Python code for the PSP
> page. In that case, enable PSP debug mode using:
>
>   AddHandler mod_python .psp_
>   PythonHandler mod_python.psp | .psp_
>
> and access URL 'index.psp_'.
>
> Check manual on how to do this, as my memory on how to do that is really
> bad.
>
> Graham
>
>>>> util.redirect(req,"modules/reports/index.psp?hidval=f&showcnt=25&user=%s"%se
>>>> ssion['user'])
>>
>> i have made it as
>>
>> util.redirect(req,"http://localhost/edi/modules/reports/index.psp?hidval=f&showcnt=25&user=%s"%se
>> ssion['user'])
>>
>> Still not working
>>
>> Rahul
>>
>>
>>> 2009/3/31 rahul <rahul.warhekar at edisphere.com>:
>>>> Hi graham,
>>>>
>>>> I have done what you suggested but was not successful.
>>>> My code in index.psp is
>>>>
>>>>
>>>> <%
>>>> import os
>>>> from mod_python import Session
>>>> from mod_python import util
>>>> from mod_python import psp
>>>> _REQUEST = util.FieldStorage(req)
>>>> view = "reports"
>>>> user =''
>>>> session.load()
>>>>
>>>> if view=='reports':
>>>>
>>>> util.redirect(req,"modules/reports/index.psp?hidval=f&showcnt=25&user=%s"%se
>>>> ssion['user'])
>>>
>>> This isn't what I told you to use.
>>>
>>> Having a path that doesn't start with a '/' will not ever work either.
>>>
>>>> else:
>>>>        req.write("Invalid User")
>>>>
>>>> %>
>>>>
>>>> And full error message is
>>>
>>> That is not the full message.
>>>
>>> Post the complete Python traceback giving lines numbers, files etc.
>>>
>>> Graham
>>>
>>>> Mod_python Error: mod python stuff
>>>> And in last it gives
>>>>
>>>> File C:/wamp/www/edi/modules/reports/index.psp
>>>> WindowsError [Errno2]: The system cannot find the file specified.
>>>>
>>>>
>>>> According to me it seems that my mod_python code is not getting
>>>> executed
>>>> or
>>>> either it is not registered.
>>>>
>>>> Any suggestion on this will be greatly appreciated.
>>>>
>>>> Thanks,
>>>>
>>>> Rahul
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: Graham Dumpleton [mailto:graham.dumpleton at gmail.com]
>>>> Sent: Monday, March 30, 2009 11:33 AM
>>>> To: rahul.warhekar at edisphere.com
>>>> Cc: Tim Valenta; mod_python at modpython.org
>>>> Subject: Re: [mod_python] Getting error as The system cannot find the
>>>> file
>>>> specified
>>>>
>>>> 2009/3/30  <rahul.warhekar at edisphere.com>:
>>>>> ok, sorry for that,
>>>>>
>>>>> I am using util.redirect(req,"/edi/modules/index.psp")
>>>>
>>>> Technically the second argument, as I said before, must be a full URI,
>>>> including 'http://host'. Supplying a path only as you have may or may
>>>> not work depending on the browser.
>>>>
>>>> For starters, therefore change it to:
>>>>
>>>>  util.redirect(req,req.construct_url("/edi/modules/index.psp"))
>>>>
>>>> and see if that works.
>>>>
>>>> And that you are using a virtual machine is likely got nothing to do
>>>> with
>>>> it.
>>>>
>>>> Graham
>>>>
>>>>> my document root dir is c:\wamp\www
>>>>>
>>>>> Thanks
>>>>> Rahul
>>>>>
>>>>>> You did not answer my question.
>>>>>>
>>>>>> What is your code passing as the second argument to:
>>>>>>
>>>>>>   util.redirect
>>>>>>
>>>>>> function call?
>>>>>>
>>>>>> I cannot help if you do not answer the question. You are already
>>>>>> stressing the abilities of the crystal ball as it is by not
>>>>>> supplying
>>>>>> enough actual useful information.
>>>>>>
>>>>>> Graham
>>>>>>
>>>>>> 2009/3/30  <rahul.warhekar at edisphere.com>:
>>>>>>> hello all
>>>>>>>
>>>>>>> I am using virtual machine. On it we are having wamp server 2.6
>>>>>>> running.
>>>>>>>
>>>>>>> any suggestion for this situation.
>>>>>>>
>>>>>>> Any help will be greatly appreciated.
>>>>>>>
>>>>>>> Thanks
>>>>>>> rahul
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> What is "path to file"?
>>>>>>>>
>>>>>>>> It must be a properly formed URI, ie., 'http://host/.....'. You
>>>>>>>> should
>>>>>>>> not be just supplying a local URL without the 'http://host' bit.
>>>>>>>>
>>>>>>>> Graham
>>>>>>>>
>>>>>>>> 2009/3/30 rahul <rahul.warhekar at edisphere.com>:
>>>>>>>>> No I get error while using util.redirect(req,”path to file”)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Regards
>>>>>>>>>
>>>>>>>>> rahul
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ________________________________
>>>>>>>>>
>>>>>>>>> From: Tim Valenta [mailto:tonightslastsong at gmail.com]
>>>>>>>>> Sent: Saturday, March 28, 2009 12:08 AM
>>>>>>>>> To: rahul
>>>>>>>>> Cc: Graham Dumpleton; mod_python at modpython.org
>>>>>>>>> Subject: Re: [mod_python] Getting error as The system cannot find
>>>>>>>>> the
>>>>>>>>> file
>>>>>>>>> specified
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> When do you get the error?  When you start Apache?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Tim
>>>>>>>>>
>>>>>>>>> On Fri, Mar 27, 2009 at 6:25 AM, rahul
>>>>>>>>> <rahul.warhekar at edisphere.com>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>> Hello all,
>>>>>>>>>
>>>>>>>>> I am using my mod_python for my web application.
>>>>>>>>>
>>>>>>>>> And I am getting "WindowsError: [Errno 2] The system cannot find
>>>>>>>>> the
>>>>>>>>> file
>>>>>>>>> specified" error.
>>>>>>>>>
>>>>>>>>> Any quick help reg this will be greatly appreciated and this is
>>>>>>>>> really
>>>>>>>>> urgent.
>>>>>>>>>
>>>>>>>>> Thanks in advance.
>>>>>>>>>
>>>>>>>>> Rahul
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> Mod_python mailing list
>>>>>>>>> Mod_python at modpython.org
>>>>>>>>> http://mailman.modpython.org/mailman/listinfo/mod_python
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> "Python is the unholy bastard step-child between Ruby and PHP."
>>>>>>>>> "I'd let an ipod blow up on my leg for $150,000."
>>>>>>>>> "but Ben and Jerry do make a lovely couple."
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>>
>>
>




More information about the Mod_python mailing list