Cyberpi has no attribute 'get_shield'


#1

I’m having problem importing cyberpi, in the python editor.

this simple code:

import cyberpi
print('hello world')

results in this error message:

Traceback (most recent call last):
    File "C:\Users\pnaze\.mcode\virtualFS\projects\default\/hellomakeblock/test.py", line 1, in <module>
        import cyberpi
    File "C:\Users\pnaze\.mcode\site-packages\cyberpi\__init__.py", line 11, in <module>
        get_shield=cyberpi.get_shield
AttributeError: module 'makeblock.modules.cyberpi.api_cyberpi_api' has no attribute 'get_shield'

I’m running mBlock v5.4.0
in the python editor
with python 3.6.5

>>> sys.version
'3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46)

on Windows 10.

Can you please help me resolve this error.

Thanks


#2

found the problem and its solution.

On Feb 8th of 2022, version 0.0.7 of cyberpi was released. This version has a bug that results in the ‘get_shield’ error above. Meaning anyone who recently received mbot recently and attempted to install cyberpi after Feb 8th 2022 has had this problem, but those who installed cyberpi before Feb 8th don’t have this problem.

The solution is to go back to version 0.0.5.

Go to Python Editor.
Write this three line script and “Run” it.

import subprocess
import sys
subprocess.check_call([sys.executable, "-m", "pip", "install", "cyberpi==0.0.5"])

now you can import the cyberpi package.


#3

interresting … (yes i never run into this problem, could you add a documentation for this in my server plz ? ) https://discord.gg/duqTctda (yes i am making an ad for my lonely server, sorry for bothering you for nothing) Have a great day :smiley:


#4

also yes, this is a makeblock server


#5

You can try making a post about your server in the forum, if you’d like…


#6

That’s a good idea XD