File access and threads

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Petter Holmström

    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-
  • Aahz

    #2
    Re: File access and threads

    In article <4084b3eb@newsf lash.abo.fi>,
    =?ISO-8859-1?Q?Petter_Holm str=F6m?= <peholmst@abo.f i> wrote:[color=blue]
    >
    >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.[/color]

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

    "I used to have a .sig but I found it impossible to please everyone..." --SFJ

    Comment

    • Petter Holmström

      #3
      Re: File access and threads

      Aahz wrote:[color=blue]
      >
      > Could you at least post a full traceback?[/color]

      Is this enough?


      === TRACEBACK BEGINS ===
      Mod_python error: "PythonHand ler 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.gettem pdir()

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

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

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

      === TRACEBACK ENDS ===

      -Petter-

      Comment

      • Aahz

        #4
        Re: File access and threads

        In article <40864030$1@new sflash.abo.fi>,
        =?ISO-8859-1?Q?Petter_Holm str=F6m?= <peholmst@abo.f i> wrote:[color=blue]
        >Aahz wrote:[color=green]
        >>
        >> Could you at least post a full traceback?[/color]
        >
        >Is this enough?[/color]

        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 (aahz@pythoncra ft.com) <*> http://www.pythoncraft.com/

        "I used to have a .sig but I found it impossible to please everyone..." --SFJ

        Comment

        Working...