hologram-io / hologram-python

Hologram device-side Python SDK - Send messages to the cloud in just 3 lines of code!
https://hologram.io/
MIT License
89 stars 47 forks source link

cannot import name 'TOTPAuthentication' from 'HologramAuth' (unknown location) #54

Open danistrigaro opened 4 years ago

danistrigaro commented 4 years ago

Describe the problem

I'm on ubuntu 20.04. I installed the packacke as described in the quickstart guide. The problem is that the HologramAuth package seems to be empty. When I try to run:

sudo hologram send "Hello World"

or when I try to update the firmware this error appears:

ImportError: cannot import name 'TOTPAuthentication' from 'HologramAuth' (unknown location)

I think the problem regards this line in the HologramCloud.py file when it tries to import such libraries that does not exists anywhere:

from HologramAuth import TOTPAuthentication, SIMOTPAuthentication

issue-label-bot[bot] commented 4 years ago

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.86. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

danistrigaro commented 4 years ago

I think there is a connection with this issue #20 . I had the same problem with Ubuntu 20.04 and python 3.8. For this reason I looked into the HologramAuth folder and I saw only .pyc files compiled probably with a different operating system. So I deleted them and consequently, the issue in the object appeared.

DomAmato commented 4 years ago

Yeah this is an issue with trying to distribute compiled byte code as a python package. As far as I can tell there is no way to compile for different python versions and then pack it all together and have it work on different versions of python. We do this as a security measure for the authentication package but the side effect of that is that it only works for python 3.7 which is the current default python 3 package on raspberry pis. If you tried to use the SDK on python 3.8 it would give you a bad magic number error like the issue you linked as well.

openAccess commented 4 years ago

You do realize one can simply use uncompyle6 to decompile the bytecode.

DomAmato commented 4 years ago

yes we are aware of that