Hi,
I'm having trouble while import package requests in python
root@mylinkit:/IoT# python
imporPython 2.7.9 (default, Oct 26 2015, 17:43:12)
[GCC 4.8.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/requests/__init__.py", line 118, in <module>
from . import utils
File "/usr/lib/python2.7/site-packages/requests/utils.py", line 25, in <module>
from . import certs
File "/usr/lib/python2.7/site-packages/requests/certs.py", line 15, in <module>
from certifi import where
File "/usr/lib/python2.7/site-packages/certifi/__init__.py", line 1, in <module>
from .core import contents, where
File "/usr/lib/python2.7/site-packages/certifi/core.py", line 17
def where() -> str:
^
SyntaxError: invalid syntax
I've already uninstall requests package and install again but it still occur this error.
Here is my information about OpenWrt OS and Python Linux version 3.18.21 (buildbot@builder1) (gcc version 4.8.3 (OpenWrt/Linaro GCC 4.8-2014.04 r47269) ) #5 Fri Nov 20 12:43:14 CET 2015 Python 2.7.9 (default, Oct 26 2015, 17:43:12) [GCC 4.8.3] on linux2 Type "help", "copyright", "credits" or "license" for more information.
Could anyone suggest me how to fix this.
Yes sir, It has been deprecated but the problem is:
I have 50 modules, but only 5 pcs out of 50 have this issue. The rest still working fine.
And this python is built inside module MT7688 when I bought it from manufacturer, and code still working well with 45/50 pcs.
This forum is about official builds obtainable from downloads.openwrt.org or built yourself from the published source code. If you are using a manufacturer's custom built firmware, get support from them.
Python 2 is no longer built in the official builds. All Python applications should be migrated to Python 3.
Then that means that the modules where your code isn't working have different versions of those Python-libraries than the rest, for whatever reason -- the whole firmware is probably a slightly different version.
You could try copying the Python-libraries from a working device. If that doesn't work, then you'll need to replace the firmware with the same version as on the working ones.
How would we know? The firmware your modules are running is customized by Seeed and therefore the servers it is downloading packages from can also be theirs. That's the whole point everyone has been telling you: you're not running OpenWrt, you're running Seeed's customized version of it and we do not know what they have and what they haven't modified.
If you want to know where it's downloading its packages from, look into /etc/opkg/distfeeds.conf
If you want to copy all the Python-libraries:
Format an SD-card or a USB-stick as ext4, then mount the card or stick on your working module. Then cp -a /usr/lib/python2.7 /path/to/your/card-or-stick/
Unmount the card/stick, move it to the other module, mount the card/stick there, then cp -a /path/to/your/card-or-stick/python2.7 /usr/lib/
Or if you just want to copy the certifi-library:
Format an SD-card or a USB-stick as ext4, then mount the card or stick on your working module. Then cp -a /usr/lib/python2.7/site-packages/certifi /path/to/your/card-or-stick/
Unmount the card/stick, move it to the other module, mount the card/stick there, then cp -a /path/to/your/card-or-stick/certifi /usr/lib/python2.7/site-packages/