GithubHelp home page GithubHelp logo

Comments (6)

jaap3 avatar jaap3 commented on May 30, 2024

I'm not sure, smuggler hasn't really been tested on windows as far as I known.

When you upload a fixture it is saved in a temporary directory and then it's loaded. For some reason on your system this file seems to be locked. Does this happen every time you try to load?

It's hard to reproduce/debug this issue without access to a Windows system, so a PR to demonstrate and fix this issue would be much appreciated.

(Currently travis only runs on linux so that'll have to change as well).

from django-smuggler.

semente avatar semente commented on May 30, 2024

Hey, @ManiMozaffar and @kenliit! I'm sorry you are having this issue on Windows. As @jaap3 noted, it is hard for us debug this issue because we don't run a Windows environment so could you share the whole traceback output?

It is not clear for me if the error happens on smuggler.utils.load_fixtures or on os.unlink() from https://github.com/semente/django-smuggler/blob/master/smuggler/views.py#L149.

from django-smuggler.

semente avatar semente commented on May 30, 2024

It is possible that it is missing a stream.close() at https://github.com/semente/django-smuggler/blob/master/smuggler/utils.py#L69.

from django-smuggler.

jaap3 avatar jaap3 commented on May 30, 2024

Temporary files are created here:

destination_path = tempfile.mkstemp(suffix=suffix, prefix=prefix + "_")[

They are written here:

def save_uploaded_file_on_disk(uploaded_file, destination_path):

Removed here:

os.unlink(tmp_file)

I think the issues is related to the creation of the temporary files. mkstemp returns a tuple of two values a file pointer and a path (https://docs.python.org/3/library/tempfile.html#tempfile.mkstemp), smuggler ignores the first one and always uses a path.

However, the file pointer is similar to an open file.

I found this Stack Overflow answer which probably contains the correct solution:

https://stackoverflow.com/questions/34716996/cant-remove-a-file-which-created-by-tempfile-mkstemp-on-windows

It would be greatly appreciated if someone with access to a Windows computer can test this fix and make a pull request.

from django-smuggler.

jaap3 avatar jaap3 commented on May 30, 2024

I created a pull request, but cannot test if this is actually the correct solution.

from django-smuggler.

semente avatar semente commented on May 30, 2024

good catch @jaap3!

from django-smuggler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.