[mod_python] PYC download prompt

Jim Gallacher jpg at jgassociates.ca
Fri Jan 20 14:47:14 EST 2006


Sean Jamieson wrote:
> Jim Gallacher wrote:
> 
>> Sean Jamieson wrote:
>>
>>> Jim Gallacher wrote:
>>>
>>>> Sean Jamieson wrote:
>>>>
>>>>> Graham Dumpleton wrote:
>>>>>
>>>>>> Sean Jamieson wrote ..
>>>>>>  
>>>>>>
>>>>>>> Has anyone else run into the problem, that when there is some 
>>>>>>> unknown error with mod_python it spits out the .pyc version of 
>>>>>>> your source code?
>>>>>>> either that or gives a File Not Found (rather than a useful error)?
>>>>>>>
>>>>>>> I have a source that is working fine on my laptop:
>>>>>>> Apache/2.0.54 (Ubuntu) mod_python/3.1.3 Python/2.4.2
>>>>>>> and my dev server has the same setup...
>>>>>>>
>>>>>>> What happend when I copied the source to my dev server was:
>>>>>>> 1) I got a Not Found error
>>>>>>> 2) I refreshed
>>>>>>> 3) I was given the .pyc for the file requested
>>>>>>>
>>>>>>> again, this works fine on my laptop which is using the same 
>>>>>>> OS/apache/python/mod_python
>>>>>>> there maybe some minor differences in apache config, but nothing 
>>>>>>> that I
>>>>>>> know of which would affect mod_python.
>>>>>>>
>>>>>>> Can anyone give me a clue as to where I should try looking?
>>>>>>>   
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> One can get wierd things like this happening if you have MultiViews
>>>>>> enabled and are using URLs which have no extensions.
>>>>>>
>>>>>> So for starters try using:
>>>>>>
>>>>>>  Options -MultiViews
>>>>>>
>>>>>> in your Apache configuration and see if things change.
>>>>>>
>>>>>> Also, what handler are you using, your own, mod_python.publisher
>>>>>> or something else? It is possible that you might be hitting one of
>>>>>> the issues since fixed in mod_python 3.2.
>>>>>>
>>>>>> Graham
>>>>>>
>>>>>>  
>>>>>>
>>>>> Puiblisher, and yes, I realized that the .pyc being sent was a 
>>>>> result of MultiViews later on. My main issue now, is that my 
>>>>> codebase which runs fine on my laptop, does not run on my 
>>>>> development server; both are running the same software.
>>>>>
>>>>> I've been trying to find some key difference in apache's 
>>>>> configuration that may cause it, but alas, no matter how much I 
>>>>> copy it doesn't work.
>>>>>
>>>>> This is rather serious, as I have a client waiting to see this 
>>>>> thing, this afternoon.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Is the server publicly accessible? If so I can see what I get from 
>>>> here. If you don't want the URL on the mailing list you can email me 
>>>> privately.
>>>>
>>>> Jim
>>>
>>>
>>>
>>>
>>> currently there is nothing to get, now, when one tries to go to the 
>>> URL, the browser does nothing, literally. i.e. if you're on the 
>>> directory index page, and you click one of the .py files, or a 
>>> directory with an index.py, it does nothing, if I open a new tab, and 
>>> paste the URL, hit enter or click 'go', it does nothing, nothing 
>>> loads, it still says (Untitled) as if it went nowhere.
>>>
>>> and this seems to only happen when I try to import something from my 
>>> codebase,
>>> a plain .py file that simply has the following defined, works:
>>>
>>> def index( req ):
>>>    return req.filename
>>>
>>> I just don't get what's going on here, it doesn't make the least bit 
>>> of sense.
>>
>>
>>
>> I'll agree with you there.
>>
>> I'm sure this is stating the obvious but is there anything in the 
>> error log? Have you tried logging a message to the error log? 
>> (req.log_error("It's alive!"))
>>
>> Have you taken a look at the page source for the page returned? I've 
>> been tricked by this before where I haven't set the content_type and 
>> returned some string representation of an object which the browser 
>> interprets as an html tag. eg <thingy.main.thing object at 0xb7d2670c>.
>>
>> Jim
> 
> 
> no. I don't think you get what I mean, the page does not transition to 
> any other page.
> i.e. 1) I and viewing the Directory Index
>      2) I click the test.py that imports something from my project
>      3) firefox's loading icon spins for a second
>      4) I am still seeing the Directory Index

You're right. I thought you were getting just a blank page.

> apache2/error.log is showing more than a few segfaults...

Segfaults! Now we are getting somewhere. There are likely some subtle 
differences in the python libraries and apache modules being used on the 
server and laptop. The usual culprits libexpat and mysql clientlib used 
by php, but other libs can cause problems too. These links may help you 
sort it out:

http://www.dscpl.com.au/articles/modpython-006.html
http://www.modpython.org/FAQ/faqw.py?req=all#2.13

Jim


More information about the Mod_python mailing list