Re: [Tutor] To check for empty string after a portion of the string in python 3.6

2018-12-03 Thread srinivasan
ode 0 2. Output when device is not enabled When the device is not connected, I get the below error saying "IndexError: list index out of range" The value of res Scanning ... Traceback (most recent call last): the value ['Scanning ...'] File "/home/sriniv

[Tutor] To check for empty string after a portion of the string in python 3.6

2018-12-03 Thread srinivasan
Dear Python Experts, Could you please help me, as am still learning python syntax, how can I add conditional check for empty string after running "hcitool scan" (ie., when there is no Bluetooth devices discovered) ie., after the word "Scanning..." , when there are no Bluetooth discover-able devic

Re: [Tutor] Error Python version 3.6 does not support this syntax.

2018-11-29 Thread srinivasan
n range(0, 10): print(i) time.sleep(1) # Seems to be an issue -- bl.get_paired_devices() print("Getting Paired devices for 10 seconds...") for i in range(0, 10): print(i) time.sleep(1) Error Logs: Traceback (most recent call last

Re: [Tutor] Error Python version 3.6 does not support this syntax.

2018-11-29 Thread srinivasan
print(e) return None if __name__ == "__main__": print("Init bluetooth...") bl = Bluetoothctl() print("Ready!") bl.start_scan() print("Scanning for 10 seconds...") for i in range(0, 10): print(i)

[Tutor] Error Python version 3.6 does not support this syntax.

2018-11-27 Thread srinivasan
Dear Python Experts, As still I am newbie and learning python, I am trying to reuse the Bluetoothctl wrapper in Python from the link ( https://gist.github.com/egorf/66d88056a9d703928f93) I am using python3.6 version, In pycharm editor on the bold highlighted code snippets I see the error message "

Re: [Tutor] Issue in using "subprocess.Popen" for parsing the command output

2018-11-27 Thread srinivasan
assddWiFi", "T.f.o.s.1996!abcdfg")) On Sun, Nov 25, 2018 at 11:05 PM Steven D'Aprano wrote: > > I think you are sending email using Gmail. If so, there is a command in > Gmail to send only PLAIN TEXT with no added formatting. Please use it. > Your code at the moment has

Re: [Tutor] Issue in using "subprocess.Popen" for parsing the command output

2018-11-25 Thread srinivasan
Even only with "*proc.decode("utf-8")"* in the above code still it seems to throw the error #return proc.strip().decode("utf-8") #return proc.decode("utf-8").strip() *return proc.decode("utf-8")* Error: /home/srinivasan/Downloads

[Tutor] Issue in using "subprocess.Popen" for parsing the command output

2018-11-25 Thread srinivasan
.CalledProcessError as e:* *s = """While executing '{}' something went wrong.* *Return code == '{}'* * Return output:\n'{}'* * """.format(cmd, e.returncode, e.outpu

[Tutor] Issue in parsing the string output from the command using "subprocess"

2018-11-18 Thread srinivasan
eturncode, e.output, shell=enable_shell) raise AssertionError(s) return result.strip().decode("utf-8") if __name__ == "__main__": m = wifi() print("disconnect and reconnect") print(m.wifi_disconnect_reconnect("NaWiFi", "abcds&

[Tutor] Cannot find reference 'bluetoothctl' in 'sh.py' less... (Ctrl+F1)

2018-11-14 Thread srinivasan
Dear Python Experts, As am newbie to python, I am planning to automate BT functionality test using Bluez "bluetoothctl" utility by writing python wrapper and robot framework integrated with Jenkins I came across the below link: https://www.reddit.com/r/raspberry_pi/comments/4bxu2o/bluetoothctl_i

[Tutor] All of a sudden code started throwing errors

2018-11-14 Thread srinivasan
Dear Python Experts Could you please let me know why am I seeing the following errors as before this it was working consistently? root:~/qa/robot_tests# python3 -m robot --variable SIGNAL_LEVEL_THRESHOLD:-60 wifi_testing.robot

[Tutor] Unable to get the gateway IP of wlan interface using python code

2018-11-12 Thread srinivasan
Dear Python Experts, *First method:* I need to get the IP address basically the gateway IP in my setup I get it as "192.168.178.1" when I run the below standalone python code. *def get_gateway_ip(self):* *"""* *Get the IP address to the WIFI module from the AP* *

[Tutor] Issue in parsing the strings in python code

2018-11-12 Thread srinivasan
Dear Python Experts team, This question might be very simple for you, As am newbie to python, could you please how to parse the below strings 1. Could you please do the needful in guiding me, that how can I extract the strings under the UUID column in python code in the below output (nmcli c show

Re: [Tutor] best way to dynamically set class variables?

2018-11-08 Thread srinivasan
Once again thanks a lot guys for all your help and I really appreciate it that I can really come back to you, if am stuck with any python issues, as i was really a embedded linux platform developer >From now I have learnt not to use much bash commands with pipe and to just use the bash command and

Re: [Tutor] SyntaxError: can't assign to literal while using ""blkid -o export %s | grep 'TYPE' | cut -d"=" -f3" % (fs)" using subprocess module in Python

2018-11-07 Thread srinivasan
till my output is: */dev/mmcblk1p1: LABEL="efi" UUID="1084-AA42" TYPE="vfat"* My expected output should be only: *vfat* Could you guys please do the needful? On Wed, Nov 7, 2018 at 11:10 AM Brian J. Oney wrote: > On Wed, 2018-11-07 at 10:22 +0100, srinivasan w

Re: [Tutor] SyntaxError: can't assign to literal while using ""blkid -o export %s | grep 'TYPE' | cut -d"=" -f3" % (fs)" using subprocess module in Python

2018-11-07 Thread srinivasan
x27;TYPE' | cut -d" > and BETA=" -f3" > > Other issues may also be there. > -Original Message- > From: Tutor On Behalf Of > Alan Gauld via Tutor > Sent: Tuesday, November 6, 2018 7:37 PM > To: tutor@python.org > Cc: python-...@python.org > Subje

[Tutor] SyntaxError: can't assign to literal while using ""blkid -o export %s | grep 'TYPE' | cut -d"=" -f3" % (fs)" using subprocess module in Python

2018-11-06 Thread srinivasan
Dear Python Experts Team, As am newbie to python development, I am trying to use the below function to get verify the filesystem type of the SD card parition using bash command in python using subprocess module, I ma seeing the below Error "SyntaxError: can't assign to literal" *CODE:* ** im

Re: [Tutor] Binary chop function - this works, but I'm not sure why

2008-02-14 Thread Arun Srinivasan
On Thu, Feb 14, 2008 at 11:41 AM, Arun Srinivasan <[EMAIL PROTECTED]> wrote: > > On Thu, Feb 14, 2008 at 5:27 AM, bob gailer <[EMAIL PROTECTED]> wrote: > > > > Arun Srinivasan wrote: > > > I'm trying to learn Python, and I decided to try kata 2 from

Re: [Tutor] Binary chop function - this works, but I'm not sure why

2008-02-14 Thread Arun Srinivasan
On Thu, Feb 14, 2008 at 5:27 AM, bob gailer <[EMAIL PROTECTED]> wrote: > > Arun Srinivasan wrote: > > I'm trying to learn Python, and I decided to try kata 2 from the > > CodeKate website. It's basically just a challenge to implement a > > binary sear

[Tutor] Binary chop function - this works, but I'm not sure why

2008-02-13 Thread Arun Srinivasan
I'm trying to learn Python, and I decided to try kata 2 from the CodeKate website. It's basically just a challenge to implement a binary search in different ways. I wrote an implementation that works, but I'm confused as to why. def chop(search_int, sorted_list): if len(sorted_list) == 1 or