Skip to content
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

Youtube-DL python package overriding OS file unlock method #21545

Open
FabianNiehaus opened this issue Jun 27, 2019 · 3 comments
Open

Youtube-DL python package overriding OS file unlock method #21545

FabianNiehaus opened this issue Jun 27, 2019 · 3 comments

Comments

@FabianNiehaus
Copy link

@FabianNiehaus FabianNiehaus commented Jun 27, 2019

Checklist

  • I'm reporting a broken site support issue
  • I've verified that I'm running youtube-dl version 2019.06.27
  • I've checked that all provided URLs are alive and playable in a browser
  • I've checked that all URLs and arguments with special characters are properly quoted or escaped
  • I've searched the bugtracker for similar bug reports including closed ones
  • I've read bugs section in FAQ

Verbose log

As this is not an issue with youtube-dl's functionality itself, but rather it's interaction with another package, there is no log to be provided.

The following error is thrown when trying to store a file using the Django Framework while the youtube_dl package is installed:

Internal Server Error: /
Traceback (most recent call last):
  File "<<Project base directory removed for privacy>>\venv\lib\site-packages\django\core\files\move.py", line 61, in file_move_safe
    locks.lock(fd, locks.LOCK_EX)
  File "<<Project base directory removed for privacy>>\venv\lib\site-packages\django\core\files\locks.py", line 80, in lock
    ret = LockFileEx(hfile, flags, 0, 0, 0xFFFF0000, byref(overlapped))
ctypes.ArgumentError: argument 6: <class 'TypeError'>: expected LP_OVERLAPPED instance instead of pointer to OVERLAPPED

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<<Project base directory removed for privacy>>\venv\lib\site-packages\django\core\handlers\exception.py", line 34, in inner
    response = get_response(request)
  File "<<Project base directory removed for privacy>>\venv\lib\site-packages\django\core\handlers\base.py", line 115, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "<<Project base directory removed for privacy>>\venv\lib\site-packages\django\core\handlers\base.py", line 113, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "<<Project base directory removed for privacy>>\GenreClassificationWeb\webClassification\views.py", line 29, in upload
    name = fs.save(uploaded_file.name, uploaded_file)
  File "<<Project base directory removed for privacy>>\venv\lib\site-packages\django\core\files\storage.py", line 52, in save
    return self._save(name, content)
  File "<<Project base directory removed for privacy>>\venv\lib\site-packages\django\core\files\storage.py", line 261, in _save
    file_move_safe(content.temporary_file_path(), full_path)
  File "<<Project base directory removed for privacy>>\venv\lib\site-packages\django\core\files\move.py", line 67, in file_move_safe
    locks.unlock(fd)
  File " <<Project Directory>>\venv\lib\site-packages\django\core\files\locks.py", line 86, in unlock
    ret = UnlockFileEx(hfile, 0, 0, 0xFFFF0000, byref(overlapped))
ctypes.ArgumentError: argument 5: <class 'TypeError'>: expected LP_OVERLAPPED instance instead of pointer to OVERLAPPED

Description

When trying to store a file using the FileSystemStorage.save() method in the Django Framework, the afromentioned exceptions is thrown upon unlocking the newly stored file using the OS unlock function in locks.py.

Removing the youtube_dl package does immediately resolve this issue. Sadly, youtube-dl is necessary for this project due to a lack of working cross-platform alternatives.

This issue has been recreated with a Windows 10 and a Windows 7 machine using different VENVs.

I do believe this is a bug and have cross-posted a ticket with the Django Project (https://code.djangoproject.com/ticket/30603)

@baldoarturo
Copy link

@baldoarturo baldoarturo commented Nov 14, 2019

I can confirm this happens only on windows systems

@Motiph
Copy link

@Motiph Motiph commented Mar 26, 2020

any solution for this?

still happening in windows 10 with django 3

@shadowstriker15
Copy link

@shadowstriker15 shadowstriker15 commented Mar 26, 2020

Yeah, having this issue as well...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.