Opened 16 years ago

Closed 16 years ago

Last modified 13 years ago

#8900 closed (fixed)

TemporaryFileUploadHandler - Windows Permission Error (ErrNo 13)

Reported by: anonymous Owned by: Karen Tracey
Component: File uploads/storage Version: 1.0
Severity: Keywords: TemporaryFileUploadHandler
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When I upload files with the TemporaryFileUploadHandler I get a Permission Denied Exception.

  1. try:


 83. os.remove(old_file_name) ...

  84. except OSError, e:
  85. # Certain operating systems (Cygwin and Windows)
  86. # fail when deleting opened files, ignore it
  87. if getattr(e, 'winerror', 0) != 32:
  88. # FIXME: should we also ignore errno 13?
  89. raise

So what I get is the errno 13.

Here is the full stack trace:

Environment:

Request Method: POST
Request URL: http://localhost:8000/experiments/3/upload_file/
Django Version: 1.0-final-SVN-8968
Python Version: 2.4.0
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.formtools',
 'django.contrib.markup',
 'sites',
 'experiments']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.middleware.doc.XViewMiddleware',
 'django.middleware.transaction.TransactionMiddleware')


Traceback:
File "C:\Programme\Python24\lib\site-packages\django\core\handlers\base.py" in get_response
  86.                 response = callback(request, *callback_args, **callback_kwargs)
File "D:\projects\openContext\src\experiments\views.py" in upload_file
  105.             datafile.file.save(filename, request.FILES['file'], save=False)
File "C:\Programme\Python24\lib\site-packages\django\db\models\fields\files.py" in save
  74.         self._name = self.storage.save(name, content)
File "C:\Programme\Python24\lib\site-packages\django\core\files\storage.py" in save
  45.         name = self._save(name, content)
File "C:\Programme\Python24\lib\site-packages\django\core\files\storage.py" in _save
  150.                     file_move_safe(content.temporary_file_path(), full_path)
File "C:\Programme\Python24\lib\site-packages\django\core\files\move.py" in file_move_safe
  83.         os.remove(old_file_name)

Exception Type: OSError at /experiments/3/upload_file/
Exception Value: [Errno 13] Permission denied: 'D:\\projects\\openContext\\htdocs\\media\\temp\\_5xns1.upload'

-Toni

Change History (5)

comment:1 by (none), 16 years ago

milestone: post-1.0

Milestone post-1.0 deleted

comment:2 by Jacob, 16 years ago

milestone: 1.1
Triage Stage: UnreviewedAccepted

I guess we should ignore errno 13, too.

comment:3 by Karen Tracey, 16 years ago

Owner: changed from nobody to Karen Tracey
Status: newassigned

I've got Windows and this is causing test suite failures I can see on Python 2.3 and Python 2.4 so I'll fix it.

comment:4 by Karen Tracey, 16 years ago

Resolution: fixed
Status: assignedclosed

Fixed by r10396 on trunk, r10397 on 1.0.X branch. (Don't know why it didn't auto-close itself.)

comment:5 by Jacob, 13 years ago

milestone: 1.1

Milestone 1.1 deleted

Note: See TracTickets for help on using tickets.
Back to Top