loboris / ESP8266_AT_LoBo

New ESP8266 AT-Firmware with many added features
Other
39 stars 4 forks source link

Python 2 seems to be required #8

Open jcrossley3 opened 4 years ago

jcrossley3 commented 4 years ago

I'm on Fedora 31, which has sort of "retired" python 2 in favor of 3. I had to make the following changes in order for ./build.sh to get past some "missing parentheses" errors:

modified   Makefile
@@ -281,7 +281,7 @@ endif
    @echo "!!!"

 ifeq ($(app), 0)
-   @python ../tools/gen_appbin.py $< 0 $(mode) $(freqdiv) $(size_map) $(app)
+   @python2 ../tools/gen_appbin.py $< 0 $(mode) $(freqdiv) $(size_map) $(app)
    @mv eagle.app.flash.bin ../bin/eagle.flash.bin
    @mv eagle.app.v6.irom0text.bin ../bin/eagle.irom0text.bin
    @rm eagle.app.v6.*
@@ -291,10 +291,10 @@ ifeq ($(app), 0)
    @echo "eagle.irom0text.bin---->0x10000"
 else
     ifneq ($(boot), new)
-       @python ../tools/gen_appbin.py $< 1 $(mode) $(freqdiv) $(size_map) $(app)
+       @python2 ../tools/gen_appbin.py $< 1 $(mode) $(freqdiv) $(size_map) $(app)
        @echo "Support boot_v1.1 and +"
     else
-       @python ../tools/gen_appbin.py $< 2 $(mode) $(freqdiv) $(size_map) $(app)
+       @python2 ../tools/gen_appbin.py $< 2 $(mode) $(freqdiv) $(size_map) $(app)

        ifeq ($(size_map), 6)
        @echo "Support boot_v1.4 and +"

If acceptable, I'm happy to submit a PR. Other than that tiny issue, everything else worked like a charm, thanks!

atesin commented 4 years ago

what i had done:

@loboris PLEASE COMMIT THIS FILE CONVERTED FOR NEXT RELEASE

nebelgrau77 commented 4 years ago

An easy workaround: in the folder where you cloned the repo set up a virtual environment with python2. To do so, find where your python2 is: which python2, on my machine (Kubuntu 20.04) it was /usr/bin/python2.

Create a virtual environment with

virtualenv -p /usr/bin/python2 venv

then activate it with

source venv/bin/activate

Now if you just type python you'll see that it's 2.7.x and not 3.x.x. And ./build.sh works like a charm :)

uzi18 commented 4 years ago

virtualenv is good alternative, should be mentioned in readme.md

nebelgrau77 commented 4 years ago

I just opened a PR with this explanatory note added at the end, and also another fix for flashing problems.

atesin commented 2 years ago

... or even better,... should open a PR with the updated gen_appbin.py file for python3

carl1961 commented 10 months ago

On way I got this working is install python 2 and switch to python 2 Each number is command typed (copied) to terminal

  1. sudo apt install python2

  2. python2 -V Python 2.7.18

  3. ls /usr/bin/python* /usr/bin/python2 /usr/bin/python2.7 /usr/bin/python3 /usr/bin/python3.10

  4. sudo update-alternatives --list python update-alternatives: error: no alternatives for python

  5. sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 1 update-alternatives: using /usr/bin/python2 to provide /usr/bin/python (python) in auto mode

  6. sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 2 update-alternatives: using /usr/bin/python3 to provide /usr/bin/python (python) in auto mode

  7. sudo update-alternatives --config python There are 2 choices for the alternative python (providing /usr/bin/python).

    Selection Path Priority Status

    • 0 /usr/bin/python3 2 auto mode 1 /usr/bin/python2 1 manual mode 2 /usr/bin/python3 2 manual mode

Press to keep the current choice[*], or type selection number:

  1. 1 update-alternatives: using /usr/bin/python2 to provide /usr/bin/python (python) in manual mode

python --version

Python 2.7.18

carl@DESKTOP-9JE80P5:~/ESP8266_AT_LoBo/at_lobo$ ./build.sh

===================================== Building ESP8266/ESP8285 AT firmwares

Building firmware for 1MB Flash (ESP8285, DOUT spi mode) File size = 435332 esp8285_AT_1_2.bin OK esp8285_AT_2_2.bin OK

Building firmware for 512KB Flash, Flash map: 2 (512 no OTA) File size = 423140 esp8266_AT_1_0.bin OK

Building firmware for 1MB Flash, Flash map: 2 (512+512) File size = 435332 esp8266_AT_1_2.bin OK esp8266_AT_2_2.bin OK

Building firmware for 2MB Flash, Flash map: 3 (512+512) File size = 435396 esp8266_AT_1_3.bin OK esp8266_AT_2_3.bin OK

Building firmware for 4MB Flash, Flash map: 4 (512+512) File size = 435396 esp8266_AT_1_4.bin OK esp8266_AT_2_4.bin OK

Building firmware for 2MB Flash, Flash map: 5 (1024+1024) File size = 435396 esp8266_AT_1_5.bin OK

Building firmware for 4MB Flash, Flash map: 6 (1024+1024) File size = 435396 esp8266_AT_1_6.bin OK

=====================================

https://www.fosslinux.com/39384/switching-between-python-2-and-3-versions-on-ubuntu-20-04.htm