Opened 7 years ago

Closed 6 years ago

Last modified 4 years ago

#8900 closed (fixed)

TemporaryFileUploadHandler - Windows Permission Error (ErrNo 13)

Reported by: anonymous Owned by: kmtracey
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: UI/UX:

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 Changed 6 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

comment:2 Changed 6 years ago by jacob

  • milestone set to 1.1
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

I guess we should ignore errno 13, too.

comment:3 Changed 6 years ago by kmtracey

  • Owner changed from nobody to kmtracey
  • Status changed from new to assigned

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 Changed 6 years ago by kmtracey

  • Resolution set to fixed
  • Status changed from assigned to closed

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

comment:5 Changed 4 years ago by jacob

  • milestone 1.1 deleted

Milestone 1.1 deleted

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