By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,548 Members | 1,495 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,548 IT Pros & Developers. It's quick & easy.

File access and threads

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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.