| Issue 44: | Django fails to load on Windows with "AttributeError: 'module' object has no attribute 'unlink'" | |
| 5 people starred this issue and may be notified of changes. | Back to list |
What steps will reproduce the problem? 1. Install Python 2.5.2 on Windows (XP in my case) 2. Setup PATHs, etc for GAE 3. Run rietveld.py serve (or any other method of starting rietveld) 4. Navigate to http://localhost:<port>/ What is the expected output? What do you see instead? I expect it to load the Issues list as per normal. Instead, I get the exception as listed in the Issue summary What version of the product are you using? On what operating system? GAE 1.1.2, latest trunk of rietveld (revision 311) Please provide any additional information below. Basically it's due to Django's use of os.unlink in django/core/files/temp.py, line 34 When the django module is imported in rietveld/main.py, this line throws because os.unlink is not available in GAE. This could be solved either by patching Django to check for the existence of os.unlink (arguably a bit overkill for such an obscure situation), or by making it a noop in rietveld. Attached is a patch for the latter. This solves the issue for me. |
|
,
Sep 15, 2008
Just confirmed this still occurs in GAE 1.1.3 |
|
,
Sep 16, 2008
Please report this to the Django folks. They would like to be able to run without a writable filesystem. I suspect that if you patch os.unlink() to be a no-op, something else will fail, because it's probably unlinking in anticipation of writing a temp file, which will also fail... |
|
,
Sep 16, 2008
OK, no probs - I'm not sure of the best way to go about it - just checking for the presence (or lack thereof) of os.unlink works fine, but I don't know if there's a better way to deal with a non-writable filesystem as a whole. I've created a ticket (and patch) at Django here: http://code.djangoproject.com/ticket/9115 |
|
,
Oct 23, 2008
I am trying to write a webapp which does an urllib.urlopen to an outside URL. And as it appears, urllib - like django - tries to use os.unlink. here is part of the stack trace: f = urllib.urlopen(self.fURL,postData) File "/usr/lib64/python2.5/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/usr/lib64/python2.5/urllib.py", line 609, in __init__ URLopener.__init__(self, *args, **kwargs) File "/usr/lib64/python2.5/urllib.py", line 123, in __init__ self.__unlink = os.unlink # See cleanup() AttributeError: 'module' object has no attribute 'unlink' |
|
,
Oct 24, 2008
@jayeshsalvi - don't use urllib, use google.appengine.api.urlfetch. See http://code.google.com/appengine/docs/urlfetch/ |
|
,
Oct 24, 2008
@gvanrossum - Thanks a lot. That works for me. |
|
,
Jan 13, 2009
Here we go! as attach! |
|
,
Jan 13, 2009
@guiyang923: Sorry, we can't accept patches to Django here. Please comment on the Django ticket already created: http://code.djangoproject.com/ticket/9115 |
|
|
|