473,386 Members | 1,679 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 1942
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Guyon Morée | last post by:
If I have multiple threads reading from the same file, would that be a problem? if yes, how would I solve it? Let's say I want to take it a step further and start writing to 1 file form...
6
by: Dan Kelley | last post by:
We have a multithreaded app that responds to events, and writes these events to a text file. This text file is used by an external system for further processing. We want to be able to write...
1
by: edo | last post by:
Following is a summary of articles spanning a 7 day period, beginning at 12 Dec 2003 05:22:35 GMT and ending at 19 Dec 2003 04:09:06 GMT. Notes ===== - A line in the body of a post is...
2
by: edo | last post by:
100 Day Analysis Following is a summary of articles spanning a 100 day period, beginning at 10 Sep 2003 06:41:30 GMT and ending at 19 Dec 2003 04:09:06 GMT. Notes ===== - A line in the...
4
by: Otis Hunter | last post by:
I have been given an Access Database which contains a table that has an OLE object field that contains a Word document. That table contains hundreds of records. I would like to find out how I can...
4
by: Tony Liu | last post by:
Hi, how can I create multiple new file handles of a file without having to share to file to the other processes? I have a file that will be accessed by multiple threads in my application, each...
3
by: Ron Vecchi | last post by:
I have a single line file where the line will be read and updated each time it is opened. My question is I need to open it with a lock so noone else can read or write to it untill the lock is...
4
by: Paddy | last post by:
We have a recurring problem where a (long-running) service throws an exception while trying to access a file. The problem is that this is very rare (happens once every week and without warning) but...
8
by: Lonifasiko | last post by:
Hi, Using Process class I asynchronously launch an executable (black box executable) file from my Windows application. I mean asynchronously because I've got an EventHandler for "Exited" event....
16
by: WATYF | last post by:
Hi there... I have a huge text file that needs to be processed. At the moment, I'm loading it into memory in small chunks (x amount of lines) and processing it that way. I'd like the process to be...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.