Thread: [Flashforth-devel] ff-shell3.py question
Brought to you by:
oh2aun
From: Mark E. <mar...@gm...> - 2024-07-05 23:51:22
|
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 |
From: Mikael N. <mik...@fl...> - 2024-07-06 05:16:26
|
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 |
From: Mark E. <mar...@gm...> - 2024-07-06 16:10:24
|
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 |
From: Mark E. <mar...@gm...> - 2024-07-06 18:29:19
|
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 > |
From: Mikael N. <mik...@fl...> - 2024-07-06 19:13:55
|
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 |
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 |
From: Peter J. <p.j...@uq...> - 2024-07-07 22:21:47
|
Mark, Mikael, Until today, I have used the Tcl script only on Linux and Windows computers. Your note prompted me to try it on a mac mini (M1) but I find that it becomes unresponsive once to tries to open the serial port. Note that I start it from the command line as "wish ff-shell.tcl" so that I get the homebrew-installed Tcl/Tk 8.6 rather than the older 8.5 that seems to come with macOS. I'll have to read the documentation to see what is different on a mac and to work out how to get the right environment when starting a script with a shebang. Regards, Peter J. ________________________________ From: Mark Ennamorato <mar...@gm...> Sent: Monday, 8 July 2024 2:11 AM To: Mikael Nordman <mik...@fl...> Cc: fla...@li... <fla...@li...> Subject: Re: [Flashforth-devel] ff-shell3.py question 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 |