Bad Magic Number with Python 3.8

The fault appears to be the same as that identified in “Bad Magic Number” posted in December of 2019, but I am running a current version of Python (3.8).

I’ve tried all of the fixes listed in the original post, but none of them solved the issue.

sudo pip uninstall hologram-python
sudo pip uninstall python-sdk-auth
sudo pip install hologram-python

sudo pip3 uninstall hologram-python
sudo pip3 uninstall python-sdk-auth
sudo pip3 install --no-cache-dir hologram-python

Error message:
hologram -vv modem signal

File “/usr/local/bin/hologram”, line 19, in
from scripts.hologram_send import parse_hologram_send_args
File “/usr/local/lib/python3.8/dist-packages/scripts/hologram_send.py”, line 14, in
from Hologram.HologramCloud import HologramCloud
File “/usr/local/lib/python3.8/dist-packages/Hologram/HologramCloud.py”, line 15, in
from HologramAuth import TOTPAuthentication, SIMOTPAuthentication
ImportError: bad magic number in ‘HologramAuth’: b’B\r\r\n’

Yeah its an issue with the authentication library, right now we only have it compiled for 3.7 for ARM so it will only run on a pi running 3.7. I am working on removing that as a hard dependency but it also means that you will have to provide a device key instead of using the OTP that the SDK generates through the authentication package.

Here is the working branch for that at the moment.

Appreciate the pointer! I’ll check it out. So is there not going to be support for x64 processors in the future? That would make the platform unusable for my use case.

Wow, that just sunk in. I currently have 10-NOVAs on Hologram that have been part of a very successful pilot. Everything worked fine when attached to x64 devices running Python 2.x. For that to just disappear.

There is still support, the problem is we haven’t found a good way to distribute compiled byte code for the authentication package for multiple architectures and multiple python versions through pip. I can compile the code for x64 systems and drop a link for it though obviously being able to install it through pip would be more ideal.

The base SDK will work on any linux system regardless of architecture (so long as they can install ppp).

The auth package only affects the more seamless authentication methods so all the functionality exists on that branch except for OTP, which you can replace with the device key authentication method.

1 Like

Good to know! I understand that it must be challenging. If you can provide a documented workaround that would be great. Even if it’s non-optimal. I need to ship a device this week and right now it will either go out without out-of-band support, or I’ll have to scramble to find another solution provider. Really appreciate the after-hours responses!

So there are a few approaches.

  1. You could try downgrading to python 3.7. We’re testing it now to make sure if x86 works with the auth package on 3.7.

  2. You can install that branch doing pip install -e git+https://github.com/hologram-io/hologram-python.git@refactor/removeauth#egg=hologram-python. On that branch you need to pass in a device key which can be generated and found here: https://support.hologram.io/hc/en-us/articles/360035212714-Device-keys

    1. If you are using the SDK command line then info on how to pass the key look here: https://hologram.io/docs/reference/cloud/hologram-cli/

    2. if you are using a python script you can pass in the key as a dict as part of the credentials as explained here: https://hologram.io/docs/reference/cloud/python-sdk/#hologramcloud-credentials-network-authentication_type-totp-

Let me know if there is anything else you have questions about

Any updates or something else I can try? Very frustrated that a modem that’s always just worked is now requiring my development time.

Finally got things to work manually. Now to see if I can script it all. Thanks for pointing me in the right direction!

If you are curious how to script it the install script is just a bash script here: hologram-python/install.sh at develop · hologram-io/hologram-python · GitHub

Regarding the open source part, it is open source, and it is free. You are trying to use the software on a currently unsupported version of python so while the work around is a bit kludgy I think thats fair to expect when the docs mention that only python 3.7 is currently supported: https://hologram.io/docs/reference/cloud/python-sdk/

1 Like

Thank you again for your support! I edited my comment as my frustrations were showing through last night…

Its fine we all experience it, I have been updating python libraries that haven’t been touched in several years so I know how annoying it can be when open source projects die but have no viable replacement…

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.