-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WindowsError: [error 32] #19
Comments
Hi, thanks for reporting this. Can you explain more why you are creating an Excel file in the The actual conversion to the various file formats happens in the renderers rather than the serializers. With the default settings, the provided If you would like more control over how the excel file is generated, you can do it by creating a custom |
Hi, I just want to import export csv and xlsx files, but i didnt setup url suffixes in mi urls.py so I needed to hard code that part inside So if client sends |
The url suffixes aren't required - they're just a shortcut for All of the content type negotiation is handled in Django REST Framework, so you don't need to hard code anything to switch between formats - it should just work. To determine which output format to generate (i.e., which renderer class to use), DRF looks at the:
So, when you got this working on OS X it was likely because the default settings already support |
Thanks for your detailed explanation, I did a specific test for this issue, but with my current knowledge Im not sure is this Windows Error is about restframework or pandas repo itself. I guess Windows is locking the file somehow , somewhere, but I dont know where can I dig further. Anyway here is my test outpout followed by my test code.
Test Code, (This succeeds con Linux (Ubuntu))
|
Ok, this does look like a bug in DRP. Basically the renderer is trying to delete the temporary file before it's been closed. I made a quick patch to the master version - can you see if it fixes the issue? |
Hi, Did tests with last commit and issue persists. I opened my renderers.py to confirm the inclusion of the patch and also deleted pyc file related to renderers.py.
WindowsError: [Error 32] El proceso no tiene acceso al archivo porque estß siendo utilizado por otro proceso: 'c:\users\lherna~1\appdata\local\temp\tmp8ldsy5.xlsx' |
I am running into this same permission error on Windows machines but found the update below seemed to eliminate the error.
|
Same error here. I'm running Windows 8.1, Django 1.9.6 and rest-pandas 0.4.0. class PandasFileRenderer(PandasBaseRenderer):
"""
Renderer for output formats that absolutely must use a file (i.e. Excel)
"""
def init_output(self):
file, filename = mkstemp(suffix='.' + self.format)
self.filename = filename
os.close(file) There is an interesting thread about it here: |
Thanks @jrowen and @lorenzopiquer, the key was to close the file in |
I am experiencing this error on Windows 7.
When this code is executed:
Output.xlsx is being generated on the root folder of the project.
The text was updated successfully, but these errors were encountered: