-
Notifications
You must be signed in to change notification settings - Fork 257
OSError("a valid MAC could not be determined.") #408
Comments
Huh, weird. We don't really get any more debugging information from python about this, so I'd suggest just picking a mac and sticking with it. My best guess: it has something to do with permission levels. Maybe try running the script as an admin and see if it works? |
Thanks but admin doesn't work. |
Not sure if you're using WiFi with a controller that supports MAC address randomization. If so, go to |
I don't have this option so I guess my hardware doesn't support it. On 8 February 2016 at 22:50, thebigmunch [email protected] wrote:
|
^ #418 is showing the same problem off of windows. I'm thinking maybe the python 3 changes broke mac address detection? It seems weird to have a bunch of people run into this at once. |
I can take a look later tonight and see if I can repro this on Windows. |
Great; thanks. |
Unless you've been contacted by a lot of people through email, I don't think 2 really counts as a bunch : P My desktop (and main development/testing machine) is Windows 8.1, and I commonly use a remote server running Gentoo as my Linux testing machine. I've been testing a lot recently and haven't come across this. Up until after I made those last bytes/unicode fixes, I was using both Python 2.7.11 and Python 3.5. Though now I only use Python 3.5. @dvirtz @lelandbatey: What version of Python are you guys using? If this isn't Python 2-specific, it sounds a lot more like a some kind of system issue/quirk. |
I've tested both Python 2.7.11 and 3.5 and the issue reproduces. However,
|
I looked into this and didn't really learn anything (I couldn't reproduce this on a Windows 7 or 10 VM). uuid is implemented in Python and has a variety of things it will try to resolve getnode. They're all very platform specific, so I'm baffled as to what could be causing the same issue across multiple platforms. On Windows, the routines look basically identical (modulo some bytes/long changes) between 2.7 and master. It tries a system call (using ctypes), then netbios, then ipconfig. I would ask @dvirtz and @lelandbatey to try running uuid.getnode() and try stepping through using pdb to see if something really crazy is happening (like we're actually getting one of these "invalid" addresses not as the fallback). I can write a simple script if it would help. |
I did it and uuid.getnode() returns some value, but its bit 40 is set, so the line |
Right. That doesn't give us any more information, though. Do you know how to use the python debugger to step into the call to getnode? |
getnode just returns what the windows function |
uuid.getnode() returns a 48 bit integer representation of a MAC address if it was obtained or a random 48 bit integer if an address can't be obtained. So, it's still a good idea to find out why Python doesn't seem to be getting a valid MAC from your systems. |
seems like a problem on windows'
And the return value of |
In an effort to debug this further, I put up a gist that will print out what each method of getting the MAC address returns. I would recommend running it by doing something like this (on a nix-like):
On Windows, you can download the raw python file, save it somewhere and then run it from the command prompt in the same way. @dvirtz and @lelandbatey: can you run that and let us know what it prints? It won't actually give us your MAC address. |
|
It's interesting that the different methods return different addresses. Do you have several network adapters or virtual adapters or something? Just curious... @simon-weber, do we need to check that bit? @dvirtz says that login succeeds even in this case. @thebigmunch, I think that calls to |
@tjstum: I should have specified to do it in different runs. The bit needs to be checked to prevent a new device from being created on your Google account and, in the case of Musicmanager, Google Music every time you login. I can't remember if the Mobileclient will create a new device on Google Music as well. |
@dvirtz, if you run that script without --anonymize, is the result you get from _windll_getnode an actual MAC address on your machine? |
No, I don't see it on the output of 'ipconfig /all'
|
Sorry to respond after so long, but here's the results from running your
Additionally, here is the output of
@tjstum it seems the Thank you for doing all this debugging work so far, if there's anything else I can do to help with this bug, please let me know. |
@dvirtz and @lelandbatey, when you run without --anonymize repeatedly, are the addresses you get from the first method (either _unixdll_getnode or _windll_getnode) the same each time, or do they appear to be different each time? This is sort of looking like a bug in uuid itself, tbh. |
One thing that can cause weirdness with uuid is the system clock -- I actually managed to crash it with https://github.com/simon-weber/python-libfaketime once. |
@tjstum I get the same address repeatedly from |
I have no idea then 😞 If you're getting the same result from Either way, I don't have a great suggestion for how this could be handled by gmusicapi. Overriding the internals of |
…off#28 Add support for optional credentials.py - Allows sharing user credentials between scripts. - Prevents accidental public commits of live credentials. Users can now easily specifiy an android_id other than FROM_MAC_ADDRESS - Workaround for simon-weber/gmusicapi#408 - android_id can also be specified in the optional credentials file Resolves: maxkirchoff#28
I just started having this problem on an ubuntu 16.10 machine - all was working fine until a few days ago. This was the error I was getting (using gmusicapi-scripts).
Weirdly enough, a reboot seems to have fixed it. This is my ifconfig output:
Always found it a bit weird that no hwaddress is explicitly specified, but the ether is equivalent, no? Maybe a recent change to networkmanager fiddled this up? |
Huh, very bizarre. Especially that it'd clear up after a reboot. |
Trying to reproduce .... Maybe something did fudge up the ability for Python to grab a MAC address. |
A quick update: I'm having this consistently on Ubuntu 17.04 now.
Just in case anyone else was struggling with this (bizarre) issue. |
I'm going to close this since it's gone stale (and from_mac_address seems broken on Google's end anyway these days: #590). |
I'm getting this error on Centos 7. Is there any way to work around this? |
I just hacked mobileclient.py and musicmanager.py by replacing the line: and hackity, hack, it is uploading. Since this is optional, it probably should not error out if it can't find a mac, especially since the uploader_id seems to be optional. |
That will probably work, but I'd recommend passing the uploader_id param instead. There's more details as to why in the docs. |
I started getting this error on every login attempt on a Windows 10 machine.
Until a couple of days before it didn't complain and when I try this on a VirtualBox runnig Ubuntu it works perfectly.
Any idea?
The text was updated successfully, but these errors were encountered: