Re: [Dorset] funny in python software
On Thursday, 12 November 2020 15:14:23 GMT Keith Edmunds wrote: > I've never used Kate (vim for me), but it sounds as if it is > syntax-highlighting 'connect' in one file and not the other. That suggests > either something else has changed so that 'connect' doesn't make sense, or > there may be some non-visual problem with 'connect' (eg, an 8bit char in > there or - silly examples - you've put "Connect" or "c0nnect" or something > like that). Kate does do syntax highlighting but it seems to base its decision on the file extension rather than the shebang (which I note in the snippet is in line 3 and not the first line as it usually is). > Do you know / can you find out what blue highlighting means? Or - shudder > - can you open the file in (g)vim and see if it looks OK there? Peter had renamed his file to 'subscriber.py.2' and Kate didn't know what to do with a .2 file. -- Terry Coles -- Next meeting: Online, Jitsi, Tuesday, 2020-12-01 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk
Re: [Dorset] funny in python software
I've never used Kate (vim for me), but it sounds as if it is syntax-highlighting 'connect' in one file and not the other. That suggests either something else has changed so that 'connect' doesn't make sense, or there may be some non-visual problem with 'connect' (eg, an 8bit char in there or - silly examples - you've put "Connect" or "c0nnect" or something like that). Do you know / can you find out what blue highlighting means? Or - shudder - can you open the file in (g)vim and see if it looks OK there? -- Linux Tips: https://www.tiger-computing.co.uk/category/techtips/ -- Next meeting: Online, Jitsi, Tuesday, 2020-12-01 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk
Re: [Dorset] funny in python software
Hi Peter, > import paho.mqtt.client as mqtt ... > broker_address= "192.168.4.1" ... > client = mqtt.Client(client_id="rc-car-11") ... > client.connect(broker_address,1883,60)# bad connect word. > > > But I still have a problem in syslog about why it failed on that > > line and it never used to. You're saying syslog has an entry complaining about the client.connect? line? What's the entry say? The normal reasons for the error would be failing to make a TCP connection, e.g. the IP address is wrong. -- Cheers, Ralph. -- Next meeting: Online, Jitsi, Tuesday, 2020-12-01 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk
Re: [Dorset] funny in python software
Forget this. The 'good' file was named subscriber.py.2 and therefore kate did not pick it up as a python file. A lot of other things were not coloured as well. But I still have a problem in syslog about why it failed on that line and it never used to. Peter On 12/11/2020 14:37, PeterMerchant wrote: I have a program for my MQTT stuff, and my subscriber file that receives instructions from the publisher failed after I had made some modifications to it. When I look at the file in kate, there is a difference that I cannot explain. In these following lines, the word 'connect' is in blue in the failing version, but not highlighted in the good version. Here are the first few lines: # 2020-09-14 This is a change to RC car-7 from using Flask and HTML to using Mosquitto # 2020-11-06 Edited to remove all the calculations leading up to the PWM percentage #!python3 # *** SET UP MQTT *** # from https://techtutorialsx.com/2017/04/23/python-subscribing-to-mqtt-topic/ import paho.mqtt.client as mqtt import time Connected = False #global variable for the state of the connection broker_address= "192.168.4.1" port = 1883 user = "rc-car-11" password = "N0YB" # Create client --?? Is this the same as User? client = mqtt.Client(client_id="rc-car-11") # Connect to broker client.connect(broker_address,1883,60) # bad connect word. # Subscriber to topic client.subscribe("rc-car-pwm") I even copied the line out of the good file and pasted into the faulty one, but 'connect' turned blue. Any thoughts? peter M. -- Next meeting: Online, Jitsi, Tuesday, 2020-12-01 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk
[Dorset] funny in python software
I have a program for my MQTT stuff, and my subscriber file that receives instructions from the publisher failed after I had made some modifications to it. When I look at the file in kate, there is a difference that I cannot explain. In these following lines, the word 'connect' is in blue in the failing version, but not highlighted in the good version. Here are the first few lines: # 2020-09-14 This is a change to RC car-7 from using Flask and HTML to using Mosquitto # 2020-11-06 Edited to remove all the calculations leading up to the PWM percentage #!python3 # *** SET UP MQTT *** # from https://techtutorialsx.com/2017/04/23/python-subscribing-to-mqtt-topic/ import paho.mqtt.client as mqtt import time Connected = False #global variable for the state of the connection broker_address= "192.168.4.1" port = 1883 user = "rc-car-11" password = "N0YB" # Create client --?? Is this the same as User? client = mqtt.Client(client_id="rc-car-11") # Connect to broker client.connect(broker_address,1883,60) # bad connect word. # Subscriber to topic client.subscribe("rc-car-pwm") I even copied the line out of the good file and pasted into the faulty one, but 'connect' turned blue. Any thoughts? peter M. -- Next meeting: Online, Jitsi, Tuesday, 2020-12-01 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk