tterb / yt2mp3

:arrow_down: Search, Download, and Convert YouTube videos to MP3

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to run

wsc96 opened this issue · comments

commented

Hi,

'pip install yt2mp3' works fine however when I attempt to run it i receive the error:

File ".local/bin/yt2mp3", line 61
SyntaxError: Non-ASCII character '\xe2' in file .local/bin/yt2mp3 on line 61, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

If I modify the file to remove the tick character (✔) I get:

Traceback (most recent call last):
File ".local/bin/yt2mp3", line 9, in
import yt2mp3, sys, argparse, logging
File "/home/myusername/.local/lib/python2.7/site-packages/yt2mp3/init.py", line 13, in
from urllib.request import Request, urlopen
ImportError: No module named request

My terminal is urxvt-unicode and displays the tick character fine whilst I'm editing the file BTW. Os is Debian GNU/Linux 9 (stretch).

Thanks for the feedback, it looks like the second error you're encountering is because Python 2.7, while the program currently only supports Python 3+.

Also, when I try running the program with Python 2.7 I received the same error regarding the "✔" symbol, so I believe this should also be fixed by switching to Python 3+.

Let me know if this doesn't solve your problem and I can investigate further.

commented

Hi,

If I install it using pip3 and attempt to run as root I get:

bash: /usr/local/bin/yt2mp3: /Users/brettstevenson/test-env/test-env/bin/python3: bad interpreter: No such file or directory

If I modify the first line to point to /usr/bin/python3 it works.

This is on another machine though so i'll test again on my typical machine when I can and advise. I had tried python3 on it and was getting a different error (I was running the install and app as a user though).

Regards!

commented

As root on first machine (same initial error but then with python3 path changed as before):

root@debian:~# yt2mp3
Track: fraction too much friction
Artist: tim finn
Traceback (most recent call last):
File "/usr/local/bin/yt2mp3", line 65, in
main()
File "/usr/local/bin/yt2mp3", line 58, in main
tempPath = yt2mp3.download(song.video_url, args.verbose)
File "/usr/local/lib/python3.5/dist-packages/yt2mp3/init.py", line 84, in download
if not os.path.exists(tempDir):
File "/usr/lib/python3.5/genericpath.py", line 19, in exists
os.stat(path)
TypeError: argument should be string, bytes or integer, not PosixPath

That was with the same randomly chosen track as previously but I'm getting the same error with others.

The machine working is using Python 3.6.6 whilst the machine that isn't is using Python 3.5.3 if that matters.

That's odd that the shebang is causing you issues, since #!/usr/bin/env python3 is the recommended shebang for compatibility to compensate for the python binary being installed in different places on different machines, so env inspects the PATH environment to find it.

Also, while I know that the need to install pip packages as root can vary on different machines, the program shouldn't have to be run as root to function correctly.

commented

The shebang line in /usr/local/bin/yt2mp3 for a new download was:

#!/Users/brettstevenson/test-env/test-env/bin/python3

That's odd as the files in the repo as well as my local files all have the #!/usr/bin/env python3 shebang. This leads me to believe that it's an issue with how the most recent release was published to PyPi, which wouldn't surprise me as it's my first package that I've published there.


Also, it appears that this error may be due to a minor discrepancy between how pathlib functions in Python 3.5 vs 3.6, but I believe this should be solved by explicitly casting the path to a string beforehand. Though, I'll do some testing with Python 3.4 & 3.5 to make sure.

Traceback (most recent call last):
File "/usr/local/bin/yt2mp3", line 65, in
main()
File "/usr/local/bin/yt2mp3", line 58, in main
tempPath = yt2mp3.download(song.video_url, args.verbose)
File "/usr/local/lib/python3.5/dist-packages/yt2mp3/init.py", line 84, in download
if not os.path.exists(tempDir):
File "/usr/lib/python3.5/genericpath.py", line 19, in exists
os.stat(path)
TypeError: argument should be string, bytes or integer, not PosixPath

commented

Hi,

I upgraded python to 3.6 on the machine which was playing up and it is now working as expected. Good work on this!

The album art that gets downloaded is pretty low quality. Is there any way to adjust this?

Also, should I close the Issue?

Regards!

Thanks, I'm glad we were able to get it straightened out.

I've been looking into increasing the resolution of the album art, so I'm hoping to find a solution to that, the shebang issue, and the Python 3.4-3.6 compatibility for the next update.
So I'll leave this issue open until those issues are fixed.

I've managed to address the cover-art image size and the Python 3.4-36 compatibility, and it appears that the shebang issue may be prevented by specifying the correct shebang with the additional --executable build option.
So I'll make sure to get a new version published to PyPi within the next day or so.