Re: [Flashforth-devel] ff-shell3.py question
Brought to you by:
oh2aun
From: Mark E. <mar...@gm...> - 2024-07-07 16:11:40
|
Hello Mikael, OK…so chalk up this mostly to operator error.. the only thing I *really* needed to do is create the “.ff.history” file before running the script. the “missing file” error message I originally ran into was caused by that *but* I went down a rat-hole thinking there were other issues. at one point though I did get the error message about "local variable 'e' referenced before assignment” BUT that is gone now and I cannot explain why except that maybe while playing with the code I did something bad.. but right now its working fine. On to the tcl script though I cannot get that to work on my M1 MacBook air for some reason even though tcl/tk is installed. i’ll start a different debug thread on that. thanks mark > On Jul 6, 2024, at 12:13 PM, Mikael Nordman <mik...@fl...> wrote: > > So did you have to change some python statements to get it working on OSX ? > > Something I could incorporate in the distribution ? > > Mikael > > On 2024-07-06 21:28, Mark Ennamorato wrote: > >> found it..fixed it thanks. >> now..on to getting the tcl script to run... >> Mark >> >>> On Jul 6, 2024, at 9:10 AM, Mark Ennamorato <mar...@gm...> wrote: >>> >>> thanks Mikael, >>> >>> well... so after putting some debug prints in the code i found out the "No such file..." error message was due to the fact that its trying to find this file that did not exist and had nothing to do with the usb serial port ! >>> >>> histfn = os.path.join(os.path.expanduser("~"), ".ff.history") >>> >>> so once i 'touched' ~/.ff.history it ran until I hit this snag >>> >>> local variable 'e' referenced before assignment >>> >>> which... 'e' is used for the "try...except" 's and not sure why python is complaining about it since its always something like >>> >>> except Exception as e: kind of thing >>> >>> weird >>> >>> mark >>> >>>> On Jul 5, 2024, at 10:16 PM, Mikael Nordman <mik...@fl...> wrote: >>>> >>>> So I added the close() and open() to serial_open(config) and it works just fine on linux, maybe then also on OSX. >>>> Like this: >>>> >>>> try: >>>> config.ser = serial.Serial(config.port, config.rate, timeout=0.5, writeTimeout=1.0, rtscts=config.hw, xonxoff=config.sw) >>>> config.ser.close() >>>> config.ser.open() >>>> >>>> Does that help ? >>>> >>>> Mikael >>>> >>>> On 2024-07-06 02:50, Mark Ennamorato wrote: >>>>> Hi sorry..somewhat frustrated at the moment im sure there is something dumb i am doing / not doing but.. >>>>> I *cannot* get the ff-shell3.py shell working at all .. M1 Mac, python 3.9.0 >>>>> USB serial on /dev/tty.usbmodem13201 >>>>> I changed tried running the ff-shell3.py with 'python3 ff-shell3.py /dev/tty.usbmodem13201' and get the dreaded "No such file or directory: /dev/tty.usbmodem13201' even though I can connect to it with screen no issues. >>>>> So them I was looking at the code and see its got a serial port object "class Config(object)" and it so i changed default serial port to /dev/tty.usbmodem13201' in it but still same issue. >>>>> hmm.... this should not be so difficult. >>>>> so i played with some simple python code inside the repl. just using see = serial.Serial(PORT, BAUD) using same port /dev/tty.usbmodem13201 and then ser.open() and I get "serial port is already open" .. so i do ser.close() first them ser.open() and it works, it sees my serial port just fine. >>>>> so why isn't the ff-shell3.py seeing my serial port ?? >>>>> TIA >>>>> Mark >>>>> _______________________________________________ >>>>> Flashforth-devel mailing list >>>>> Fla...@li... >>>>> https://lists.sourceforge.net/lists/listinfo/flashforth-devel >>>> >>>> -- >>>> -- >>>> Mikael >>>> >>>> >>>> _______________________________________________ >>>> Flashforth-devel mailing list >>>> Fla...@li... >>>> https://lists.sourceforge.net/lists/listinfo/flashforth-devel > > -- > -- > Mikael |