Function passed as an argument returns none

2014-10-01 Thread Shiva
x27; else: prefix = ' X ' print (('%s got: %s expected: %s') % (prefix, repr(got), repr(expected))) Only 'None' gets passed on to parameter 'got' instead of the expected value of 4. Any idea why 'None' is getting passed even though call

Re: Function passed as an argument returns none

2014-10-02 Thread Shiva
ut of a function return something specific. * return 'Number of donuts: ',countreturns a tuple like: ('Number of donuts: ',9) * To just print the string without returning it as tuple , use string formatting. Thanks again, Shiva -- https://mail.python.org/mailman/listinfo/python-list

Returning a List

2014-10-03 Thread Shiva
#return b+c return d front_x(['bbb', 'ccc', 'axx', 'xzz', 'xaa']) Why is return d or return b+c not returning anything?? The d's value is confirmed by the print statement. Thanks, Shiva. -- https://mail.python.org/mailman/listinfo/python-list

Re: Returning a List

2014-10-03 Thread Shiva
Chris Angelico gmail.com> writes: > > On Fri, Oct 3, 2014 at 9:35 PM, Shiva > yahoo.com.dmarc.invalid> wrote: > > Why is return d or return b+c not returning anything?? > > > > On what basis do you believe it's not returning anything? When you > call i

Issue in printing top 20 dictionary items by dictionary value

2014-10-04 Thread Shiva
Hi All, I have written a function that -reads a file -splits the words and stores it in a dictionary as word(key) and the total count of word in file (value). I want to print the words with top 20 occurrences in the file in reverse order - but can't figure it out. Here is my function: def prin

Re: Issue in printing top 20 dictionary items by dictionary value

2014-10-04 Thread Shiva
How does textstorage.get(w,0)+1 give the count of the word?? Thanks, Shiva -- https://mail.python.org/mailman/listinfo/python-list

Re: Issue in printing top 20 dictionary items by dictionary value

2014-10-05 Thread Shiva
Larry Hudson yahoo.com.dmarc.invalid> writes: > > On 10/04/2014 10:36 AM, Shiva wrote: > > > > What I don't understand is: > > > > for w in eachword: > > textstorage[w]=textstorage.get(w, 0) + 1 > > > > How does textstora

re search through a text Vs line

2014-10-05 Thread Shiva
ename,'r') line = fileextract.readlines() for l in line: texts = re.search(r'1\d\d\d', line) print(texts.group()) None is returned. Why is it not iterating through each line of the file and doing a search? - It seems to return none. Thanks, Shiva -- https://mail.python.org/mailman/listinfo/python-list

Re: re search through a text Vs line

2014-10-05 Thread Shiva
return texts.group() fileextract.close() extract_names('NOTICE.txt') Thanks, Shiva -- https://mail.python.org/mailman/listinfo/python-list

while loop - multiple condition

2014-10-12 Thread Shiva
' doesn't seem to evaluate. Thanks, Shiva. -- https://mail.python.org/mailman/listinfo/python-list

Re: while loop - multiple condition

2014-10-12 Thread Shiva
> The loop will continue while either part is true - that's what "or" > means. Is that what you intended it to be doing? > > ChrisA > Yes..however, the second part of the or condition doesn't get evaluated. So if I enter a 'y' - I expect the second part to evaluate and the loop to break -

Re: while loop - multiple condition

2014-10-12 Thread Shiva
Bit confusing to use in While loop - Should have used the 'and' condition instead of OR- then it works fine. for OR both condition need to be false to produce a false output and break the loop. More of SET operations. Thanks, Shiva -- https://mail.python.org/mailman/listinfo/python-list

downloading from links within a webpage

2014-10-14 Thread Shiva
ltodownload in matches[0:50]: imagename=urltodownload[-12:] urllib.request.urlretrieve(urltodownload,imagename) print('Done!') Thanks, Shiva -- https://mail.python.org/mailman/listinfo/python-list

Creating a counter

2014-10-15 Thread Shiva
condition statement - and execute the script in terminal - for each find, the print() prints in new line instead of a constantly incrementing counter. Thanks, Shiva -- https://mail.python.org/mailman/listinfo/python-list

Re: Creating a counter

2014-10-16 Thread Shiva
> > Python3: >print(counter, end='\r') > > Gary Herron > > Thanks, that is what I was looking up - \r carriage return without linefeed. Thanks again! Shiva -- https://mail.python.org/mailman/listinfo/python-list

The difference sports gambling online sport book

2008-10-05 Thread shiva
webpage - http;//elemotor.blogspot.com/ The difference sports gambling online sport book The difference sports gambling online sport book no doubt partly sports gambling online sport book to the fact sports gambling online sport book our first glimpses sports gambling online sport book of He

Create notifications in python

2016-01-13 Thread Shiva Upreti
I want to create notification box using python just like I get when battery is running low or something similar. I can do it using libnotify in linux, but I cant figure out how to do it in windows. I got some codes on internet for this like: https://gist.github.com/wontoncc/1808234, however it d

wxpython strange behaviour

2016-01-15 Thread Shiva Upreti
https://gist.github.com/anonymous/4baa67aafd04555eb4e6 I wrote the above code to display a toasterbox, and I didnt want it to display any frames on the screen, just a toasterbox. The problem with this code is that it runs fine when I run it the first time, but when I run it next time it shows s

Re: wxpython strange behaviour

2016-01-15 Thread Shiva Upreti
On Friday, January 15, 2016 at 10:35:57 PM UTC+5:30, Shiva Upreti wrote: > https://gist.github.com/anonymous/4baa67aafd04555eb4e6 > > I wrote the above code to display a toasterbox, and I didnt want it to > display any frames on the screen, just a toasterbox. The problem with thi

Re: wxpython strange behaviour

2016-01-15 Thread Shiva Upreti
On Friday, January 15, 2016 at 10:55:59 PM UTC+5:30, Ian wrote: > On Fri, Jan 15, 2016 at 10:05 AM, Shiva Upreti > wrote: > > https://gist.github.com/anonymous/4baa67aafd04555eb4e6 > > > > I wrote the above code to display a toasterbox, and I didnt want it to >

Re: wxpython strange behaviour

2016-01-15 Thread Shiva Upreti
On Friday, January 15, 2016 at 10:55:59 PM UTC+5:30, Ian wrote: > On Fri, Jan 15, 2016 at 10:05 AM, Shiva Upreti > wrote: > > https://gist.github.com/anonymous/4baa67aafd04555eb4e6 > > > > I wrote the above code to display a toasterbox, and I didnt want it to >

Re: wxpython strange behaviour

2016-01-15 Thread Shiva Upreti
On Saturday, January 16, 2016 at 2:22:24 AM UTC+5:30, Mark Lawrence wrote: > On 15/01/2016 17:05, Shiva Upreti wrote: > > https://gist.github.com/anonymous/4baa67aafd04555eb4e6 > > > > I wrote the above code to display a toasterbox, and I didnt want it to > > displ

Re: wxpython strange behaviour

2016-01-15 Thread Shiva Upreti
On Saturday, January 16, 2016 at 4:39:12 AM UTC+5:30, Dietmar Schwertberger wrote: > On 15.01.2016 18:05, Shiva Upreti wrote: > > Please help me solve these issues. > Please decide first on which list or forum you want your questions to be > answered. Once people find out that you

Pyaudio and sockets

2016-03-28 Thread Shiva Upreti
I am trying to send audio using sockets to a different PC, but audio is not clear on the other end and I cant understand why. Here is the code: import socket import pyaudio import wave import sys import pickle import time HOST="" PORT=1061 s=socket.socket(socket.AF_INET, socket.SOCK_STREAM) CHU

"no module named kivy" import error in ubuntu 14.04

2015-08-16 Thread shiva upreti
Hi I am new to linux. I tried various things in attempt to install kivy. I installed python 2.7.10 (I think python3 was already installed in ubuntu 14.04). Then i downloaded kivy from https://pypi.python.org/packages/source/K/Kivy/Kivy-1.9.0.tar.gz, extracted it and tried to execute "python set

Selenium

2015-09-14 Thread shiva upreti
I wrote this code in python for submitting a login form: from selenium import webdriver from selenium.webdriver.common.keys import Keys driver = webdriver.Firefox() driver.get('some url') elem = driver.find_element_by_name("username") elem.send_keys('13103666') elem = driver.find_element_by_nam

need help with selenium

2015-09-14 Thread shiva upreti
I wrote this code in python for submitting a login form: from selenium import webdriver from selenium.webdriver.common.keys import Keys driver = webdriver.Firefox() driver.get('some url') elem = driver.find_element_by_name("username") elem.send_keys('13103666') elem = driver.find_elemen

ConnectionError handling problem

2015-09-18 Thread shiva upreti
I am learning python. I wrote a script using requests module. The scripts runs fine for sometime, but after a while it hangs. When I press CTRL+C it shows ConnectionError even though I have included exception handling. I am not sure as to why it cant handle ConnectionError when the script runs for

for loop

2015-09-20 Thread shiva upreti
https://ideone.com/BPflPk Please tell me why 'print s' statement is being executed inside loop, though I put it outside. Please help. I am new to python. -- https://mail.python.org/mailman/listinfo/python-list

Re: for loop

2015-09-20 Thread shiva upreti
On Sunday, September 20, 2015 at 1:33:57 PM UTC+5:30, Chris Warrick wrote: > On 20 September 2015 at 09:55, shiva upreti wrote: > > https://ideone.com/BPflPk > > > > Please tell me why 'print s' statement is being executed inside loop, > > though I put it

Re: for loop

2015-09-20 Thread shiva upreti
On Sunday, September 20, 2015 at 1:34:32 PM UTC+5:30, paul.ant...@gmail.com wrote: > On Sunday, September 20, 2015 at 9:56:06 AM UTC+2, shiva upreti wrote: > > https://ideone.com/BPflPk > > > > Please tell me why 'print s' statement is being executed inside loo

Re: ConnectionError handling problem

2015-09-23 Thread shiva upreti
On Sunday, September 20, 2015 at 8:11:18 PM UTC+5:30, Laura Creighton wrote: > The discussion about why or why not to use a bare except has gotten us > away from the problem reported, which is "why is my script hanging?" > > In a message of Sat, 19 Sep 2015 17:18:12 +0100, Mark Lawrence writes: >

Re: ConnectionError handling problem

2015-09-24 Thread shiva upreti
Thank you. I didnt know about keyboard interrupt exception. It means my code hangs without raising any exceptions, what should i do in this case? -- https://mail.python.org/mailman/listinfo/python-list

Re: ConnectionError handling problem

2015-09-24 Thread shiva upreti
Thank you Cameron. I think the problem with my code is that it just hangs without raising any exceptions. And as mentioned by Laura above that when I press CTRL+C, it just catches that exception and prints ConnectionError which is definitely a lie in this case as you mentioned. As my code doesnt

Re: ConnectionError handling problem

2015-09-24 Thread shiva upreti
On Thursday, September 24, 2015 at 4:09:04 PM UTC+5:30, Laura Creighton wrote: > In a message of Wed, 23 Sep 2015 19:49:17 -0700, shiva upreti writes: > >Hi > >If my script hangs because of the reasons you mentioned above, why doesnt it > >catch ConnectionError? > >My s

Re: ConnectionError handling problem

2015-09-24 Thread shiva upreti
On Thursday, September 24, 2015 at 4:09:04 PM UTC+5:30, Laura Creighton wrote: > In a message of Wed, 23 Sep 2015 19:49:17 -0700, shiva upreti writes: > >Hi > >If my script hangs because of the reasons you mentioned above, why doesnt it > >catch ConnectionError? > >My s

Re: ConnectionError handling problem

2015-09-24 Thread shiva upreti
On Friday, September 25, 2015 at 10:55:45 AM UTC+5:30, Cameron Simpson wrote: > On 24Sep2015 20:57, shiva upreti wrote: > >Thank you Cameron. > >I think the problem with my code is that it just hangs without raising any > >exceptions. And as mentioned by Laura above that wh

Re: ConnectionError handling problem

2015-09-29 Thread shiva upreti
On Friday, September 25, 2015 at 12:55:01 PM UTC+5:30, Cameron Simpson wrote: > On 24Sep2015 22:46, shiva upreti wrote: > >On Friday, September 25, 2015 at 10:55:45 AM UTC+5:30, Cameron Simpson wrote: > >> On 24Sep2015 20:57, shiva upreti wrote: > >> >Thank you Came