cancel
Showing results for 
Search instead for 
Did you mean: 

Running Python on SPWF04Sx

Marc ZK
Associate II
Posted on June 26, 2017 at 14:41

hi

I am using afor SPWF04Sx Wi-Fi module - and am trying to run the example python code provided in the user guide.

I have the SPWF04Sx configured as console 2 (UART and python)

I have created a file called wind.py and copied the code from the WIND example section 5.2 on page 17 of AN49

I have used the command 'AT+S.FSC=wind.py,479' to copy it to the RAM on the SPWF04Sx

I have tried running it by calling 'AT+S.PYTHON=wind.py' but only get the response:

File '2:wind.py', line 1

SyntaxError: invalid systax

I have also tried the basic code in 5.1 and, i have created a one line python file with only print('hello') in it.

This also gets the same SyntaxError error

Any suggestions?

I've also noticed that the CTRL short codes dont work on my system i.e. CTRL-D is not recognised to exit REPL, -and I am unable to use CTRL-E to enter Paste mode. Any ideas on that one?

Note: this post was migrated and contained many threaded conversations, some content may be missing.
13 REPLIES 13
Posted on June 26, 2017 at 14:56

File '2:wind.py', line 1

I think you are facing a copy/paste error. Please paste script into an editor (e.g. notepad++), and check what you are sending to the module.

This is what I see:

at+s.python=wind.py

AT-S.Launching script:2:wind.py

AT-S.OK:17104:10

Ciao

jerry

Marc ZK
Associate II
Posted on June 26, 2017 at 15:48

I am already using Notepad++ and there are no cut/paste errors from section 5.2

I have also tried the code from section 5.1, and this produces the same error.

Does the cut and pasted code work for you?

Marc ZK
Associate II
Posted on June 26, 2017 at 16:30

It still doesn't work for me.  I tried editing to format the python with both spaces and TABs, neither works for me.

Even a 1 line .py file with

print('hello') 

doesnt work for me 

AT+S.FSC=hello.py,16  

AT-S.OK received   

AT+S.PYTHON=hello.py

Traceback (most recent call last):

 File '2:hello.py', line 1

SyntaxError: invalid syntax

+WIND:0:Console active

Posted on June 26, 2017 at 15:58

pdf to module -> error

pdf to notepad (edit to use TABs) to module -> ok

Posted on June 26, 2017 at 20:52

I have a doubt...

Are you using STM32 Nucleo as USB2UART bridge?

Posted on June 27, 2017 at 09:03

yes I am...

Am i doing something wrong?

Posted on June 27, 2017 at 10:31

I know old versions need a delay on PC SW after every TX char. Should work better with latest version: STM32CubeExpansion_WIFI1_V3.0.2

Which version are you using?

Posted on June 27, 2017 at 10:43

I am using 

STM32CubeExpansion_WIFI1_V3.0.2 

Posted on June 27, 2017 at 10:50

I assume you are using VCOM application on STM32.

Use TeraTerm on PC. Setup -> Serial port -> set 1ms/char.

Before AT+S.PYTHON, try to run AT+S.FSP. Is the content ok? Any missing char?