[mod_python] File access is not the way it used to be

drs. Slinger Jansen slinger at cs.uu.nl
Tue Jun 13 02:31:17 EDT 2006


Dear Deron,

Thanks for your reply, I tried windows\temp and that worked like a 
charm! Thanks. Now I'm trying to deal with your other remark, with 
locking and stuff. Especially because my app will accept uploads from 
many different sources...

In case anyone is looking for a working directory quote in WinXP:
fpLog = open("D:/xampp/htdocs/Tool/CommCenter/CommCenter.log", 'a')

Thanks again,

Slinger Jansen


Deron Meranda schreef:
> On 6/12/06, drs. Slinger Jansen <slinger at cs.uu.nl> wrote:
>>  if I run python just like that I can easily write to files, as you do,
>> using such simple things as:
>>  fp = open('debugCommCenter.out', 'w')
>>
>>  However, when these are in a server of mod_apache, nothing happens. 
>> Am I
>> blocking file access or something? Is it a permission problem, and if 
>> so,
>> how can I fix it? I've been looking for the solution on the list, and 
>> others
>> say that adding the file dir to it should work. I did that too, but then
>> still it doesn't work:
>>  fp =
>> open('d:\\xampp\\htdocs\\pytest\\debugCommCenter.out', 'w')
>
> Do you get any error messages?  Do your mod_python handlers work
> correctly otherwise?  Anyway, it could be permissions, because
> your handlers are running as the Apache user.
>
> Under modern Linuxes, the most likely cause is SElinux profiles.
> Check the /var/log/messages log file for avt: denied messages.
>
> Under Windows it could perhaps be an ACL permission (although
> I don't know Windows very well).
>
> Try perhaps to open and write to a different pathname, one that is
> likely to have open permissions such as /tmp or C:\\Windows\Temp.
>
>
> One other thing, when writing to files from within a mod_python
> handler, you need to worry about concurrent file access.  Both by
> multiple threads as well as multiple processes.  Opening files
> in append-mode and using appropriate locking mechanism is
> probably warranted.
>
> And if all you want is to output some debugging messages,
> consider using mod_python's apache.log_error() function instead.
> http://modpython.org/live/current/doc-html/pyapi-apmeth.html


-- 
Slinger Remy Lokien Jansen

*email :* slinger at cs.uu.nl <mailto:slinger at cs.uu.nl>
*office :* CGN-B228
*telephone :* +31 (30) 253 6652
*faxnumber :* +31 (30) 251 3791

*Universiteit Utrecht*
Institute of Information and Computing Sciences
Centrumgebouw Noord, office B228
Padualaan 14, De Uithof
3584CH Utrecht

*scientific website : *http://www.cs.uu.nl/people/slinger/ 
<http://www.cs.uu.nl/people/slinger>
*personal website : *www.slingerjansen.nl <http://www.slingerjansen.nl>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20060613/c30e6fae/attachment.html


More information about the Mod_python mailing list