Menu

Python shell error...

2016-03-28
2019-08-30
  • Randall Young

    Randall Young - 2016-03-28

    M.,

    Howdy!

    Always enjoy working with Flashforth, thanks for everyone's hard work!

    Simple error when I experiment with the Python shell, (2.7.9 python, ubuntu 15.04)

    "sys.exit cannot concatenate 'str' and 'int' objects"

    Any insight on this available?

    Thanks,

    R.

     
  • Mikael Nordman

    Mikael Nordman - 2016-04-03

    So what did you do before the error ?

     
  • Jake L

    Jake L - 2019-08-29

    Hello,
    I've had the same problem with the python script. Hopefully I can add something meaningful here. I'm on Ubuntu 19.04. I have the FF5 repository cloned. This computer has Python 2.7.16-1, Python 3.7.3-1, and Python-Serial 3.4-4 installed.
    From the terminal I tried the command (and got the reply):

    jake:~/flashforth/shell$ python ff-shell.py

    sys.exit cannot concatenate 'str' and 'int' objects

    then I tried:

    jake:~/flashforth/shell$ sudo python3 ff-shell.py

    File "ff-shell.py", line 49
    print "Port:"+config.port+" Speed:"+config.rate+" hw:"+str(config.hw)+" sw:"+str(config.sw)
    ^
    (the arrow should point to the "P" in Port)
    I have no clue what I'm doing when it comes to python. I'm just a casual hobbyist here. So far I've gotten the ff-shell.tcl to work, although, without the extra python script it lacks utility.
    edit removed bla bla bla....and figured out minicom's lineWrap feature...
    -Jake

    *PS I also had to fix line 2535 in ff-p18.asm to build for a PIC18F26K22 yesterday :-)

     

    Last edit: Jake L 2019-08-29
  • Mikael Nordman

    Mikael Nordman - 2019-08-30

    The shell only works with python2.
    Try giving some argument to the shell.

    python shell/ff-shell.py dfglkfjg
    usage: ff-shell.py [-h] [--port PORT] [--hw] [--sw] [--speed SPEED]
    ff-shell.py: error: unrecognized arguments: dfglkfjg
    
     
  • Mikael Nordman

    Mikael Nordman - 2019-08-30

    About minicom
    By default it does not wrap lines automatically.
    ctrl-A Z R
    enables the line wrap and you will see all the words.

     

    Last edit: Mikael Nordman 2019-08-30
  • Jake L

    Jake L - 2019-08-30

    Thanks for the reply Mikael. I'm sorry that I'm a bit slow to figure this out. In retrospect it seems quite obvious that I should try "-h" as an argument.
    I haven't looked into why my computer doesn't like connecting hardware to /dev/ttyACM0, but it usually works if I use ttyUSB0, although the port numbers change sequentially as more hardware is plugged into the port. I'm just accustomed to looking up the port with $ dmesg | grep ttyUSB. It's probably a badly configured dialout group permissions type of problem. Now that I have an idea of what the python script is looking for, I think this is why the defaults didn't work. It worked perfectly with:
    $ python /flashforth/shell/ff-shell.py -p /dev/ttyUSB0 -s 38400
    That connected right away through a CH340G breakout and a PIC18F46K22 I received yesterday and just tested.

    Thanks for all the effort you put into creating and sharing this project with people like me. I found out about this project from 0033mer on YouTube. This is my first adventure into FORTH.
    Thanks again.
    -Jake

     

Log in to post a comment.