Closed vlee489 closed 5 years ago
uuuugggghhh unicode. also ugh python 2.
Related: #84
What is your in-game nickname?
Can look more into this later.
Yeah, I had a look at it earlier. There's a proper way in python 3 to deal with this issue, but it's a bit of a mess in python 2.
I mean it's probably time this tool gets rewritten for Python 3 with the fact python 2 is reaching its end of life in 6 months.
uuuugggghhh unicode. also ugh python 2.
Related: #84
What is your in-game nickname?
Can look more into this later.
my ign is: я»Vincent
That я»
will likely be the issue.
it's probably time this tool gets rewritten for Python 3
You can use it with Python 3, and have been able to for a while. :)
Ah, my pip3 install was broken, hence I was missing dependencies, but I've ran it in python 3 and it works fine. If it's an issue related to Python 2, then there isn't much to worry about, I would just explicitly say at this point that this tool needs to run in python 3.
Yeah, I originally wanted to make the script as accessible to as many people as possible and therefore was thinking people could use this with the default Python 2 install that came with macOS. But Python 3 is heavily encouraged. We just used future
to have both supported (for now).
With Python 2 nearing its EOL, as you said, plus with the announcement at WWDC this week that future versions of macOS won't even ship with Python at all, I agree we shouldn't really have to keep supporting it. However, there isn't really much active development on this script anymore (as the game & presumably app are essentially done with updates) – and IMO it'd be great to be able to fix this error if possible, just so it does work fully in Python 2, in perpetuity... 😬
I ran into the same problem with Python 2.7.9. Did a quick Google search and found this issue that looked relevant. So I changed:
payload["uuid"] = str(uuid.uuid5(namespace, name))
to:
payload["uuid"] = str(uuid.uuid5(namespace, name.encode('ascii')))
and it worked.
But that probably won't work in Python 3, so you'd need to detect the version, I guess.
Edit: I think it's worth pointing out that the name
variable referenced above isn't the player's in-game name; it's constructed from two ID numbers connected by an @
symbol. So converting it to ASCII for Python 2 compatibility should always be safe, I think.
Oh, weird. So nicknames aren't coming into this at all… I don't really understand the source of the error, then, and I'm not able to reproduce it. Shouldn't name
always be a string, no matter the Python version? It's just made of the format battle_number
(also a string) + "@"
+ principal_id
(also a string) after all… Based on the bug @gomtuu linked, it seems this is the fault of the uuid module?
I'll just fix it by checking the Python version, I guess – I don't see any better/more-elegant way.
@vlee489 @gomtuu Can you confirm this works? Thanks!
Works for me! Thanks!
Trying to upload battles using the
-r
parm and I get thrown this error