Python27 using youtube-dl.exe in Win7 #2423

Closed
opened 2026-02-21 00:21:43 -05:00 by deekerman · 10 comments
Owner

Originally created by @happyraver1958 on GitHub (Jun 11, 2014).

I'm running youtube-dl.exe in my \windows\system32 directory from my home folder\downloads. I'm using Python 3.4.1. When I run something like "youtube-dl https://www.youtube.com/watch?v=eoXY7LSy_ZY" it comes back with:

Traceback (most recent call last):
File "C:\Python27\lib\site-packages\py2exe\boot_common.py", line 92, in
ImportError: No module named linecache
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named zipextimporter
Traceback (most recent call last):
File "main.py", line 15, in
ImportError: No module named youtube_dl

Why is it defaulting to Python27? Where can I specify that I'm not using Python 2.7? The directory listed in the message doesn't exist, my Python directory is C:\Python34.
I ran searches for support and I have found nothing even similar to this.
I believe I am doing something so stupid that nobody else has even thought of doing and that's probably why it's happening, but I'm a newbie and I haven't figured out what I'm doing wrong yet.
Any help is greatly appreciated.

Originally created by @happyraver1958 on GitHub (Jun 11, 2014). I'm running youtube-dl.exe in my \windows\system32 directory from my home folder\downloads. I'm using Python 3.4.1. When I run something like "youtube-dl https://www.youtube.com/watch?v=eoXY7LSy_ZY" it comes back with: Traceback (most recent call last): File "C:\Python27\lib\site-packages\py2exe\boot_common.py", line 92, in <module> ImportError: No module named linecache Traceback (most recent call last): File "<install zipextimporter>", line 1, in <module> ImportError: No module named zipextimporter Traceback (most recent call last): File "**main**.py", line 15, in <module> ImportError: No module named youtube_dl Why is it defaulting to Python27? Where can I specify that I'm not using Python 2.7? The directory listed in the message doesn't exist, my Python directory is C:\Python34. I ran searches for support and I have found nothing even similar to this. I believe I am doing something so stupid that nobody else has even thought of doing and that's probably why it's happening, but I'm a newbie and I haven't figured out what I'm doing wrong yet. Any help is greatly appreciated.
Author
Owner

@phihag commented on GitHub (Jun 11, 2014):

This error is really weird, but not for the reason you think it is. There are three ways to run youtube-dl:

You've picked the third option, so your version of youtube-dl should work on any system. However, it fails to load initially, and that's the weird part. I would very much like to reproduce this problem. Can you try moving youtube-dl to the current directory and re-running it? C:\Windows\System32 is pretty much mapped through all kinds of compatibility layers, so it may not be the best directory to place an executable in.

If the error persists with youtube-dl in the current directory, can you give me the following information?

  • Where did you download youtube-dl (i.e. which version do you expect)?
  • A checksum (MD5 or so) of the file would be nice, as this the only question I can find showing the same error was a result of a flipped bit in the binary file.
  • Which version of Windows are you running?
@phihag commented on GitHub (Jun 11, 2014): This error is really weird, but not for the reason you think it is. There are three ways to run youtube-dl: - Unpack the source code and simply run `python -m youtube_dl` - Download a zip file (say, from https://yt-dl.org/downloads/2014.06.09/youtube-dl ) and run that with a Python interpreter - Use the self-contained exe file which comes with its own Python interpreter, so you can just download it to an unmodified Windows system and it will just work (download URL like http://yt-dl.org/downloads/2014.06.09/youtube-dl.exe ) You've picked the third option, so your version of youtube-dl should work on any system. However, it fails to load initially, and that's the weird part. I would very much like to reproduce this problem. Can you try moving youtube-dl to the current directory and re-running it? `C:\Windows\System32` is pretty much mapped through all kinds of compatibility layers, so it may not be the best directory to place an executable in. If the error persists with youtube-dl in the current directory, can you give me the following information? - Where did you download youtube-dl (i.e. which version do you expect)? - A checksum (MD5 or so) of the file would be nice, as this the only question I can find showing the same error was a result of a flipped bit in the binary file. - Which version of Windows are you running?
Author
Owner

@happyraver1958 commented on GitHub (Jun 11, 2014):

Thank you very much for your prompt answer phihag!
I downloaded version 2014.06.09, which is the latest one I found in the list.
I am running Windows 7 Home Premium, 64-bit SP1 in a Toshiba U505 laptop.
I moved youtube-dl.exe from the \windows\system32 directory to my Users\Owner\Downloads directory and it ran fine from there. I don't know if it's because of the compatibility layers or something else; but it won't work if I run it through the Windows' path, it runs if it's called from the folder where the video was downloaded to.
Is this a bug to fix in the code somewhere?
Thanks again for the help! It did run perfectly fine from my Downloads directory.

@happyraver1958 commented on GitHub (Jun 11, 2014): Thank you very much for your prompt answer phihag! I downloaded version 2014.06.09, which is the latest one I found in the list. I am running Windows 7 Home Premium, 64-bit SP1 in a Toshiba U505 laptop. I moved youtube-dl.exe from the \windows\system32 directory to my Users\Owner\Downloads directory and it ran fine from there. I don't know if it's because of the compatibility layers or something else; but it won't work if I run it through the Windows' path, it runs if it's called from the folder where the video was downloaded to. Is this a bug to fix in the code somewhere? Thanks again for the help! It did run perfectly fine from my Downloads directory.
Author
Owner

@phihag commented on GitHub (Jun 11, 2014):

Marvellous! You can put youtube-dl into, say, C:\ytdl, and then add C:\ytdl to your PATH to be able to run youtube-dl from any directory again.

@phihag commented on GitHub (Jun 11, 2014): Marvellous! You can put youtube-dl into, say, `C:\ytdl`, and then [add `C:\ytdl` to your PATH](http://www.computerhope.com/issues/ch000549.htm) to be able to run youtube-dl from any directory again.
Author
Owner

@janeshdev commented on GitHub (Mar 31, 2015):

I am still getting similar error. I just downloaded the software today. I added the environment variable as phihag suggested but I am still getting the following error.

File "C:\Python27\lib\site-packages\py2exe\boot_common.py", line 92, in
ImportError: No module named linecache
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named zipextimporter
Traceback (most recent call last):
File "main.py", line 2, in
ImportError: No module named future

@janeshdev commented on GitHub (Mar 31, 2015): I am still getting similar error. I just downloaded the software today. I added the environment variable as phihag suggested but I am still getting the following error. File "C:\Python27\lib\site-packages\py2exe\boot_common.py", line 92, in ImportError: No module named linecache Traceback (most recent call last): File "<install zipextimporter>", line 1, in ImportError: No module named zipextimporter Traceback (most recent call last): File "_main_.py", line 2, in ImportError: No module named _future_
Author
Owner

@PaintOnBrush commented on GitHub (May 5, 2015):

make sure you don't have a copy in your system32 directory.

@PaintOnBrush commented on GitHub (May 5, 2015): make sure you don't have a copy in your system32 directory.
Author
Owner

@Lordtien commented on GitHub (May 12, 2016):

I am facing similar error as well.

@Lordtien commented on GitHub (May 12, 2016): I am facing similar error as well.
Author
Owner

@MoffD commented on GitHub (May 23, 2016):

I have had the same problem due to running it from a different directory, it worked after I cd'd into the same folder. Hopefully that helps someone if they're running it from a subdirectory like I was.
(Perhaps a pathing issue where youtube-dl can't find itself?)

@MoffD commented on GitHub (May 23, 2016): I have had the same problem due to running it from a different directory, it worked after I cd'd into the same folder. Hopefully that helps someone if they're running it from a subdirectory like I was. (Perhaps a pathing issue where youtube-dl can't find itself?)
Author
Owner

@yan12125 commented on GitHub (May 23, 2016):

@MoffD Such a problem occurs if you put youtube-dl.exe in \Windows\System32.

@yan12125 commented on GitHub (May 23, 2016): @MoffD Such a problem occurs if you put youtube-dl.exe in \Windows\System32.
Author
Owner

@MoffD commented on GitHub (May 25, 2016):

@yan12125 Interesting, however I was running it from my downloads folder with "..\youtube-dl.exe url_here" so it's not just isolated to the (DRIVE)\Windows\System32 path

@MoffD commented on GitHub (May 25, 2016): @yan12125 Interesting, however I was running it from my downloads folder with "..\youtube-dl.exe url_here" so it's not just isolated to the (DRIVE)\Windows\System32 path
Author
Owner

@yan12125 commented on GitHub (May 25, 2016):

Please post the full path and the output of youtube-dl.exe -v url_here for both successful and failed cases.

@yan12125 commented on GitHub (May 25, 2016): Please post the full path and the output of `youtube-dl.exe -v url_here` for both successful and failed cases.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/youtube-dl-ytdl-org#2423
No description provided.