Problem with urllib2.urlopen() opening a local file

D

deja user

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.
 
G

Gabriel Genellina

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?
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top