Problem with urllib2.urlopen() opening a local file

Discussion in 'Python' started by deja user, Oct 25, 2009.

  1. deja user

    deja user Guest

    I want to use urlopen() to open either a http://... file or a local
    file File:C:/... I don't have problems opening and reading the file
    either way. But when I run the script on a server (ArcGIS server),
    the request won't complete if it was trying to open a local file.
    Even though I call close() in either case, something seemed to be
    preventing the script to complete if urlopen is trying to open a local
    file. I wonder if there is anything else I should do in the code to
    kill the file descriptor, or if it is a known issue that something is
    leaking

    When running the script standalone, this is not an issue.
     
    deja user, Oct 25, 2009
    #1
    1. Advertising

  2. En Sat, 24 Oct 2009 20:10:21 -0300, deja user <>
    escribió:

    > I want to use urlopen() to open either a http://... file or a local
    > file File:C:/... I don't have problems opening and reading the file
    > either way. But when I run the script on a server (ArcGIS server),
    > the request won't complete if it was trying to open a local file.
    > Even though I call close() in either case, something seemed to be
    > preventing the script to complete if urlopen is trying to open a local
    > file. I wonder if there is anything else I should do in the code to
    > kill the file descriptor, or if it is a known issue that something is
    > leaking
    >
    > When running the script standalone, this is not an issue.


    I don't know about the ArcGIS server, but leaking a file descriptor
    usually is not a reason to not finish a request. I'd look into the server
    log files for any errors. The server might be configured to not allow
    open() of arbitrary files, by example. This seems more an ArcGIS question
    than a Python one.

    Just to be sure, "local file" in this context means "local to the server",
    ok? An url like "file://c:/path/..." (note the differences with yours) is
    only meaningful if the server is running Windows, ok?

    --
    Gabriel Genellina
     
    Gabriel Genellina, Oct 27, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Xu, C.S.
    Replies:
    5
    Views:
    495
    John J. Lee
    Sep 17, 2003
  2. Jay Davis
    Replies:
    2
    Views:
    403
    John J. Lee
    Jan 24, 2004
  3. John F Dutcher

    urllib2.urlopen(req) error........

    John F Dutcher, Jun 4, 2004, in forum: Python
    Replies:
    2
    Views:
    994
    John F Dutcher
    Jun 7, 2004
  4. Chris
    Replies:
    0
    Views:
    1,082
    Chris
    Jul 10, 2005
  5. jitu
    Replies:
    6
    Views:
    1,349
Loading...

Share This Page