469,646 Members | 1,596 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,646 developers. It's quick & easy.

File access and threads

Hello,

I have a problem with file access which I believe is caused by a
thread-problem. I first noticed it while trying to get PSP/Mod_Python to
work in the shape of an exception claiming that there are no usable
temporary directories.

The second time I noticed it was when I was trying to dump an object to
a file using pickle, and I got the "Bad file descriptor" error all the
time, even though the file was created in the file system.

I googled around and found out that there have been similar problems
before, and that these are due to threading, but I didn't manage to find
a solution (except to recompile Python without threads, which in my case
is not an option as I'm running Zope on the server).

Are there any tips you could give me?

I'm running Python 2.3.3 (from the Ports collection) on FreeBSD 5.2.1.

Thanks in advance,

-Petter-
Jul 18 '05 #1
3 1836
In article <40******@newsflash.abo.fi>,
=?ISO-8859-1?Q?Petter_Holmstr=F6m?= <pe******@abo.fi> wrote:

I have a problem with file access which I believe is caused by a
thread-problem. I first noticed it while trying to get PSP/Mod_Python to
work in the shape of an exception claiming that there are no usable
temporary directories.

The second time I noticed it was when I was trying to dump an object to
a file using pickle, and I got the "Bad file descriptor" error all the
time, even though the file was created in the file system.


Could you at least post a full traceback?
--
Aahz (aa**@pythoncraft.com) <*> http://www.pythoncraft.com/

"I used to have a .sig but I found it impossible to please everyone..." --SFJ
Jul 18 '05 #2
Aahz wrote:

Could you at least post a full traceback?


Is this enough?
=== TRACEBACK BEGINS ===
Mod_python error: "PythonHandler mod_python.psp"

Traceback (most recent call last):

File "/usr/local/lib/python2.3/site-packages/mod_python/apache.py",
line 287, in HandlerDispatch
log=debug)

File "/usr/local/lib/python2.3/site-packages/mod_python/apache.py",
line 457, in import_module
module = imp.load_module(mname, f, p, d)

File "/usr/local/lib/python2.3/site-packages/mod_python/psp.py", line
34, in ?
tempdir = tempfile.gettempdir()

File "/usr/local/lib/python2.3/tempfile.py", line 242, in gettempdir
tempdir = _get_default_tempdir()

File "/usr/local/lib/python2.3/tempfile.py", line 188, in
_get_default_tempdir
raise IOError, (_errno.ENOENT,

IOError: [Errno 2] No usable temporary directory found in ['/tmp',
'/var/tmp', '/usr/tmp', '/']

=== TRACEBACK ENDS ===

-Petter-
Jul 18 '05 #3
In article <40********@newsflash.abo.fi>,
=?ISO-8859-1?Q?Petter_Holmstr=F6m?= <pe******@abo.fi> wrote:
Aahz wrote:

Could you at least post a full traceback?


Is this enough?


Looking at the code, I'd bet on a permissions problem of some kind.
It's pretty much either that or a bug in the underlying C libraries that
gets exposed by threads -- that's a dirt-simple piece of code, really.
--
Aahz (aa**@pythoncraft.com) <*> http://www.pythoncraft.com/

"I used to have a .sig but I found it impossible to please everyone..." --SFJ
Jul 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Guyon Morée | last post: by
6 posts views Thread by Dan Kelley | last post: by
4 posts views Thread by Tony Liu | last post: by
3 posts views Thread by Ron Vecchi | last post: by
4 posts views Thread by Paddy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.