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

Python 3 related errors and what I changed #41

Open
AtomSub opened this issue Mar 8, 2016 · 0 comments
Open

Python 3 related errors and what I changed #41

AtomSub opened this issue Mar 8, 2016 · 0 comments

Comments

@AtomSub
Copy link

AtomSub commented Mar 8, 2016

Thanks for the awesome scripts. I tried using Python 3 without fully reading your requirements and got the script to work after some tweaking. However, I couldn't get my Spotify playlists into a csv format that gmusic-playlist seemed to like so I kept getting empty playlists on google music. I eventually found "portify.js" which worked for me, but playing around with your script help me learn some more about Python, so thanks again!

Anyway, in case anyone else tries to get this working with Python 3, here's what I did:

Traceback (most recent call last):
File "ImportList.py", line 171, in
input_filename = sys.argv[1].decode('utf-8')
AttributeError: 'str' object has no attribute 'decode'

Removed .decode('utf-8') (not needed in Python 3)

Traceback (most recent call last):
File "ImportList.py", line 177, in
output_filename += u'_' + unicode(datetime.datetime.now().strftime(
NameError: name 'unicode' is not defined

Removed all of the unicode() instances (same reason as above)

Traceback (most recent call last):
File "ImportList.py", line 188, in
plog('Reading playlist... ')
File "[my directory]\gmusic\common.py", line 63, in plog
log(message, nl = False)
File "[my directory]\gmusic\common.py", line 52, in log
sys.stdout.write(message.encode(sys.stdout.encoding, errors='replace'))
TypeError: write() argument must be str, not bytes

Changed
sys.stdout.write(message.encode(sys.stdout.encoding, errors='replace'))
to

sys.stdout.write(message)

File "ImportList.py", line 318, in
u'/'+len(current_songs)+' songs')
TypeError: Can't convert 'int' object to str implicitly

make sure you wrape any len() code that's being combined with a string with the str() code.

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

Successfully merging a pull request may close this issue.

2 participants