Weird bahaviour from shlex - line no

2013-09-27 Thread Daniel Stojanov
Can somebody explain this. The line number reported by shlex depends on the previous token. I want to be able to tell if I have just popped the last token on a line. import shlex first = shlex.shlex("word1 word2\nword3") print first.get_token() print first.get_token() print "line no", first.li

Re: Python Unit Tests

2013-09-27 Thread Dave Angel
On 28/9/2013 00:52, melw...@gmail.com wrote: > Hey, > What version of Python are you using? I'll assume 2.7, but you really should specify it (and any other meaningful environment dependencies) in your original query, the beginning of your thread. For 2.7, the docs for unittest are at: http://

Re: card dealer

2013-09-27 Thread Steven D'Aprano
On Fri, 27 Sep 2013 17:40:46 -0400, Ned Batchelder wrote: > On 9/27/13 12:10 PM, Denis McMahon wrote: >> On Fri, 27 Sep 2013 12:08:33 +, Dave Angel wrote: >> >>> i recall >>> writing a shuffle function in C decades ago, which took an array of >>> (52) unique items and put them in random order.

Re: Method not found: 'ServiceSettingSave' in Suds package

2013-09-27 Thread dieter
Anup Kandalkar writes: > I am trying to create service for the url: > >wsdl_url = https://avatax.avalara.net/Account/Accountsvc.wsdl > > But some error is coming: > > svc = suds.client.Client(url=wsdl_url) > File "/usr/lib/python2.7/dist-packages/suds/client.py", line 114, in > __init

Re: Help me with Python please (picture)

2013-09-27 Thread Chris Angelico
On Sat, Sep 28, 2013 at 3:18 PM, Steven D'Aprano wrote: > Could be worse -- at least you didn't take a photo of the screen with > your phone, them email the picture to yourself, then take a screenshot of > the photo in your mail client, then upload that screenshot to imgur, then > take a screensho

Re: Help me with Python please (picture)

2013-09-27 Thread Steven D'Aprano
On Fri, 27 Sep 2013 17:43:42 -0700, jae655 wrote: > http://imgur.com/E6vrNs4 > > > Can't seem to be getting an output. The problem with your code has to do with the code between pixel coordinates (29, 234) and (175, 249) approximately. If you open your image in a pixel editor, copy and paste

Python Unit Tests

2013-09-27 Thread melwin9
Hey, How do i go about coming up/coding tests for this program below. Not sure how to even approach writing about 5 tests for it. Initially I had this for the test but its not working well. Test was name test_guess.py (Code Below) [code] from unittest import TestCase import pexpect as pe im

Re: Help me with Python please (picture)

2013-09-27 Thread John Ladasky
On Friday, September 27, 2013 5:43:42 PM UTC-7, jae...@gmail.com wrote: > http://imgur.com/E6vrNs4 > > Can't seem to be getting an output. Because you aren't printing anything! One possible way to fix that is to change the line which reads... random_characters(8) to read... print(random_chara

Re: Help me with Python please (picture)

2013-09-27 Thread Denis McMahon
On Fri, 27 Sep 2013 17:43:42 -0700, jae655 wrote: > http://imgur.com/E6vrNs4 > Can't seem to be getting an output. I can't see where your output statements are. With no output statements, there is no output. perhaps you want to assign the result of the function call to a variable, and then pr

Re: Handling 3 operands in an expression without raising an exception

2013-09-27 Thread Chris Angelico
On Sat, Sep 28, 2013 at 8:06 AM, Νίκος wrote: > Well to tell the truth no matter what you say to me if something can be > written in less lines than another implementation but still retain its > simplicity and straightforward logic behind it i would prefer it! > I don't know why you think otherwis

Re: Help me with Python please (picture)

2013-09-27 Thread Dave Angel
On 27/9/2013 20:43, jae...@gmail.com wrote: > http://imgur.com/E6vrNs4 > > > Can't seem to be getting an output. Please compose a text message containing a description of the environment, the (small) code, and the expected results. This is a text mailing list, and posting transient images on untr

Re: Help me with Python please (picture)

2013-09-27 Thread Gary Herron
On 09/27/2013 05:43 PM, jae...@gmail.com wrote: http://imgur.com/E6vrNs4 Can't seem to be getting an output. Please find a way to include the code in the email. Also what evidence do you provide that it does not work? What happened when you ran it? What did you expect to happen? What w

Help me with Python please (picture)

2013-09-27 Thread jae655
http://imgur.com/E6vrNs4 Can't seem to be getting an output. -- https://mail.python.org/mailman/listinfo/python-list

Re: walking a heapq nondestructively without duplicating?

2013-09-27 Thread Ned Batchelder
On 9/27/13 6:22 PM, Tim Chase wrote: I've got a large heapq'ified list and want to walk it in-order without altering it. I get the "unsorted" heap'ish results if I just do from heapq import heappush, heappop, nlargest, nsmallest my_heap = [] for thing in lots_of_items(): heappush(

Re: Handling 3 operands in an expression without raising an exception

2013-09-27 Thread Dave Angel
On 27/9/2013 18:06, Νίκος wrote: > > city = "Άγνωστη Πόλη" > host = "Άγνωστη Προέλευση" > > If they were to have the same string assigned to them it should be okey > but they do not. > > Or perhaps you can even still think of writing the above into 1-liner > whatsoever! I already did earlier i

walking a heapq nondestructively without duplicating?

2013-09-27 Thread Tim Chase
I've got a large heapq'ified list and want to walk it in-order without altering it. I get the "unsorted" heap'ish results if I just do from heapq import heappush, heappop, nlargest, nsmallest my_heap = [] for thing in lots_of_items(): heappush(thing) for item in my_heap: ... To g

Re: Handling 3 operands in an expression without raising an exception

2013-09-27 Thread Νίκος
Στις 27/9/2013 8:00 μμ, ο/η Grant Edwards έγραψε: On 2013-09-27, ?? wrote: Sure your method follows the the logic in a straighforward way step-by-step but i just dont want to spent almost 20 lines of code just to calculate 2 variables(city and host). Does your provider charge you per

Re: card dealer

2013-09-27 Thread Ned Batchelder
On 9/27/13 12:10 PM, Denis McMahon wrote: On Fri, 27 Sep 2013 12:08:33 +, Dave Angel wrote: i recall writing a shuffle function in C decades ago, which took an array of (52) unique items and put them in random order. Whenever I tried to write shuffles I came up against a fairly fundamental

Re: Free Proxy site 2014

2013-09-27 Thread Dave Angel
On 27/9/2013 10:44, 23alagmy wrote: > Free Proxy site 2014 > search is the first proxy supports proxy access blocked sites, browsing, and > downloads without restrictions and also conceal your identity Pencah by 100% > from the sites you visit > > Sure, I'm going to trust going to a site re

Re: card dealer

2013-09-27 Thread Dave Angel
On 27/9/2013 12:10, Denis McMahon wrote: > On Fri, 27 Sep 2013 12:08:33 +, Dave Angel wrote: > >> i recall >> writing a shuffle function in C decades ago, which took an array of (52) >> unique items and put them in random order. > > Whenever I tried to write shuffles I came up against a fairly

Re: Aide pour bien démarrer en Python

2013-09-27 Thread Vincent Vande Vyvre
Le 27/09/2013 21:57, Joel Goldstick a écrit : 2013/9/27 > Je sais qu'il y a plein d'information à lire un peu partout, mais j'ai vraiment du mal à voir pourquoi Python est si fantastique... Je m'explique Pour moi python c'est un lang

Re: Download all youtube favorites with youtube-dl script

2013-09-27 Thread Thomas Kandler
On 27.09.2013 21:50, Bill wrote: > Hi. > > A screenshot would help me locate it. > > Cheers Sure. http://i.imgur.com/LvrNZYO.png I don't thing *every* profile has this, but as I said, I use youtube-dl quite often this way. Best -- https://mail.python.org/mailman/listinfo/python-list

Re: Aide pour bien démarrer en Python

2013-09-27 Thread Joel Goldstick
2013/9/27 > Je sais qu'il y a plein d'information à lire un peu partout, mais j'ai > vraiment du mal à voir pourquoi Python est si fantastique... > > Je m'explique > > Pour moi python c'est un langage de script très cryptique avec des noms de > méthodes courts, pas claire, dans une identation

Re: Download all youtube favorites with youtube-dl script

2013-09-27 Thread Bill
Thomas Kandler wrote: On 26.09.2013 17:13, Bill wrote: I have been using the script youtube-dl http://rg3.github.io/youtube-dl/ And I was wondering if there is a way to download all of a user's favorites or uploads. The script has a functionality to download all videos in a txt file. So if the

Aide pour bien démarrer en Python

2013-09-27 Thread jonathan . corriveau
Je sais qu'il y a plein d'information à lire un peu partout, mais j'ai vraiment du mal à voir pourquoi Python est si fantastique... Je m'explique Pour moi python c'est un langage de script très cryptique avec des noms de méthodes courts, pas claire, dans une identation pas toujours facile à

Re: Handling 3 operands in an expression without raising an exception

2013-09-27 Thread Joel Goldstick
On Fri, Sep 27, 2013 at 2:54 PM, Grant Edwards wrote: > On 2013-09-27, Denis McMahon wrote: > > On Fri, 27 Sep 2013 18:32:23 +0100, Mark Lawrence wrote: > > > >> On 27/09/2013 18:00, Grant Edwards wrote: > >>> On 2013-09-27, ?? wrote: > >>> > Sure your method follows the the logic i

Re: Handling 3 operands in an expression without raising an exception

2013-09-27 Thread Grant Edwards
On 2013-09-27, Denis McMahon wrote: > On Fri, 27 Sep 2013 18:32:23 +0100, Mark Lawrence wrote: > >> On 27/09/2013 18:00, Grant Edwards wrote: >>> On 2013-09-27, ?? wrote: >>> Sure your method follows the the logic in a straighforward way step-by-step but i just dont want to spen

Re: Handling 3 operands in an expression without raising an exception

2013-09-27 Thread Denis McMahon
On Fri, 27 Sep 2013 18:32:23 +0100, Mark Lawrence wrote: > On 27/09/2013 18:00, Grant Edwards wrote: >> On 2013-09-27, ?? wrote: >> >>> Sure your method follows the the logic in a straighforward way >>> step-by-step but i just dont want to spent almost 20 lines of code >>> just to calcula

Re: Hostrange expansion

2013-09-27 Thread Peter Otten
Sam Giraffe wrote: > I need some help in expanding a hostrange as in: h[1-100].domain.com > should get expanded into a list containing h1.domain.com to > h100.domain.com. Is there a library that can do this for me? I also need > to valid the range before I expand it, i.e., h[1*100].domain.com shou

Re: Handling 3 operands in an expression without raising an exception

2013-09-27 Thread Mark Lawrence
On 27/09/2013 18:00, Grant Edwards wrote: On 2013-09-27, ?? wrote: Sure your method follows the the logic in a straighforward way step-by-step but i just dont want to spent almost 20 lines of code just to calculate 2 variables(city and host). Does your provider charge you per line of

Re: Hostrange expansion

2013-09-27 Thread Joel Goldstick
On Fri, Sep 27, 2013 at 11:32 AM, Sam Giraffe wrote: > Hi, > > I need some help in expanding a hostrange as in: h[1-100].domain.comshould > get expanded into a list containing > h1.domain.com to h100.domain.com. Is there a library that can do this for > me? I also need to valid the range before

Re: Handling 3 operands in an expression without raising an exception

2013-09-27 Thread Joel Goldstick
On Fri, Sep 27, 2013 at 1:00 PM, Grant Edwards wrote: > On 2013-09-27, ?? wrote: > > > Sure your method follows the the logic in a straighforward way > > step-by-step but i just dont want to spent almost 20 lines of code just > > to calculate 2 variables(city and host). > > Does your prov

Re: Handling 3 operands in an expression without raising an exception

2013-09-27 Thread Grant Edwards
On 2013-09-27, ?? wrote: > Sure your method follows the the logic in a straighforward way > step-by-step but i just dont want to spent almost 20 lines of code just > to calculate 2 variables(city and host). Does your provider charge you per line of code? If all that matters is the num

Re: Handling 3 operands in an expression without raising an exception

2013-09-27 Thread Neil Cerutti
On 2013-09-27, ?? wrote: > Sure your method follows the the logic in a straighforward way > step-by-step but i just dont want to spent almost 20 lines of > code just to calculate 2 variables(city and host). Sure, eating with my mouth is straightforward and step-by-step, but I just want to

Re: Handling 3 operands in an expression without raising an exception

2013-09-27 Thread Νίκος
Στις 27/9/2013 6:16 μμ, ο/η Denis McMahon έγραψε: On Fri, 27 Sep 2013 12:19:53 +0300, Νίκος wrote: This is my code as i have it at the moment: ipval = ( os.environ.get('HTTP_CF_CONNECTING_IP') or os.environ.get('REMOTE_ADDR', "Cannot Resolve") ) try: gi = pygeoip.GeoIP('/usr/local/shar

Hostrange expansion

2013-09-27 Thread Sam Giraffe
Hi, I need some help in expanding a hostrange as in: h[1-100].domain.com should get expanded into a list containing h1.domain.com to h100.domain.com. Is there a library that can do this for me? I also need to valid the range before I expand it, i.e., h[1*100].domain.com should not be accept, or ot

Re: what is wrong in my code?? (python 3.3)

2013-09-27 Thread Denis McMahon
On Fri, 27 Sep 2013 06:54:48 -0700, dream4soul wrote: > #!c:/Python33/python.exe -u > import os, sys > print("Content-type: text/html; charset=utf-8\n\n") > print ('Hello, world!') > print('ранее предусматривалась смертная казнь.') > I see only first print, second it just question marks in my br

Re: card dealer

2013-09-27 Thread Denis McMahon
On Fri, 27 Sep 2013 12:08:33 +, Dave Angel wrote: > i recall > writing a shuffle function in C decades ago, which took an array of (52) > unique items and put them in random order. Whenever I tried to write shuffles I came up against a fairly fundamental limit: 52! > prng states Granted pr

Re: Handling 3 operands in an expression without raising an exception

2013-09-27 Thread Grant Edwards
On 2013-09-27, Denis McMahon wrote: > Note that there is nothing special about writing it in as few lines as > code as possible. Hah! That's what they _want_ you to think. First they get you hooked on newlines, then the newline mine owners form a cartel and start jacking up the prices. Then y

Re: unable to read combo boxes in excel by xlrd package in python

2013-09-27 Thread Neil Cerutti
On 2013-09-27, Neil Cerutti wrote: > On 2013-09-27, somesh g wrote: >> Hi..there >> >> I want to read the combo box in excel by using "xlrd" but in >> the output it is showing empty message, its not reading the >> combo box can u guys help me how to read the combo box in excel >> by "xlrd" >> >>

Re: Handling 3 operands in an expression without raising an exception

2013-09-27 Thread Denis McMahon
On Fri, 27 Sep 2013 12:19:53 +0300, Νίκος wrote: > This is my code as i have it at the moment: > > ipval = ( os.environ.get('HTTP_CF_CONNECTING_IP') or > os.environ.get('REMOTE_ADDR', "Cannot Resolve") ) try: > gi = pygeoip.GeoIP('/usr/local/share/GeoIPCity.dat') > city = gi.time_zone

Re: unable to read combo boxes in excel by xlrd package in python

2013-09-27 Thread Neil Cerutti
On 2013-09-27, somesh g wrote: > Hi..there > > I want to read the combo box in excel by using "xlrd" but in > the output it is showing empty message, its not reading the > combo box can u guys help me how to read the combo box in excel > by "xlrd" > > code written like this > > workbook = xlrd.ope

Free Proxy site 2014

2013-09-27 Thread 23alagmy
Free Proxy site 2014 search is the first proxy supports proxy access blocked sites, browsing, and downloads without restrictions and also conceal your identity Pencah by 100% from the sites you visit http://natigaas7ab.net/wp/?p=14556 -- https://mail.python.org/mailman/listinfo/python-list

unable to read combo boxes in excel by xlrd package in python

2013-09-27 Thread somesh g
Hi..there I want to read the combo box in excel by using "xlrd" but in the output it is showing empty message, its not reading the combo box can u guys help me how to read the combo box in excel by "xlrd" code written like this workbook = xlrd.open_workbook('path of the file') worksheet = work

Re: How to write in to already opened excel file by using openpyxl

2013-09-27 Thread somesh g
hi..Neil yes i dint saved that time and i added the save option and it saved Thanks for the response -- https://mail.python.org/mailman/listinfo/python-list

Re: How to write in to already opened excel file by using openpyxl

2013-09-27 Thread somesh g
Hi..joel what is said is correct i dint added save to that after adding its working perfect thanks -- https://mail.python.org/mailman/listinfo/python-list

Re: How to write in to already opened excel file by using openpyxl

2013-09-27 Thread Joel Goldstick
On Fri, Sep 27, 2013 at 9:37 AM, Neil Cerutti wrote: > On 2013-09-27, somes...@gmail.com wrote: > > Hi..there, > > > > I have opened a excel file by using the following code > > from openpyxl import load_workbook > > > > wb = load_workbook('path of the file') > > DriverTableSheet = wb.get_s

Re: How to write in to already opened excel file by using openpyxl

2013-09-27 Thread Neil Cerutti
On 2013-09-27, somes...@gmail.com wrote: > Hi..there, > > I have opened a excel file by using the following code > from openpyxl import load_workbook > > wb = load_workbook('path of the file') > DriverTableSheet = wb.get_sheet_by_name(name = 'name of the sheet') > after that i have to append

Re: Handling 3 operands in an expression without raising an exception

2013-09-27 Thread Νίκος
Στις 27/9/2013 3:17 μμ, ο/η Dave Angel έγραψε: On 27/9/2013 07:15, Νίκος wrote: Στις 27/9/2013 1:43 μμ, ο/η Dave Angel έγραψε: ipval = ( os.environ.get('HTTP_CF_CONNECTING_IP') or os.environ.get('REMOTE_ADDR', "Cannot Resolve") ) city = "Άγνωστη Πόλη" host = "Άγνωστη Προέλευση" try:

How to write in to already opened excel file by using openpyxl

2013-09-27 Thread someshg2
Hi..there, I have opened a excel file by using the following code from openpyxl import load_workbook wb = load_workbook('path of the file') DriverTableSheet = wb.get_sheet_by_name(name = 'name of the sheet') after that i have to append some values in that excel file.. for that i used the

Re: Handling 3 operands in an expression without raising an exception

2013-09-27 Thread Dave Angel
On 27/9/2013 07:15, Νίκος wrote: > Στις 27/9/2013 1:43 μμ, ο/η Dave Angel έγραψε: > >> ipval = ( os.environ.get('HTTP_CF_CONNECTING_IP') or >> os.environ.get('REMOTE_ADDR', "Cannot Resolve") ) >> city = "Άγνωστη Πόλη" >> host = "Άγνωστη Προέλευση" >> try: >> city = gi.time_zone_by_addr(

Re: card dealer

2013-09-27 Thread Dave Angel
On 27/9/2013 07:26, Dave Angel wrote: > On 27/9/2013 06:24, markot...@gmail.com wrote: > I sent the previous message long before I had finished. > > If you had created your global list containing list(range(52)), then you > could do nearly your entire program with one call to random.sample. > > ht

Re: card dealer

2013-09-27 Thread Alister
On Fri, 27 Sep 2013 03:24:28 -0700, markotaht wrote: > from random import * > from math import floor > > > kaarte_alles = 52 kaart_tõmmatud = [False for i in range(52)] > > > mast = ["ärtu", "ruutu", "poti", "risti"] > aste = ["äss", "kaks", "kolm", "neli","viis", "kuus", \ > "seitse",

nozama-cloudsearch-service 1.1.2: a local Amazon CloudSearch using ElasticSearch as its backend.

2013-09-27 Thread Oisin Mulvihill
Hello, Have you ever wanted to test your app against a dev version of your production CloudSearch? Is management saying budget constraints won't allow this? Then Nozama CloudSearch is for you. It is a light weight implementation of Amazon's CloudSearch service you can run locally. Its has additio

Re: card dealer

2013-09-27 Thread MRAB
On 27/09/2013 11:24, markot...@gmail.com wrote: from random import * from math import floor kaarte_alles = 52 kaart_tõmmatud = [False for i in range(52)] mast = ["ärtu", "ruutu", "poti", "risti"] aste = ["äss", "kaks", "kolm", "neli","viis", "kuus", \ "seitse", "kaheksa", "üheksa", "

Re: card dealer

2013-09-27 Thread Dave Angel
On 27/9/2013 06:24, markot...@gmail.com wrote: > from random import * > from math import floor > > > kaarte_alles = 52 > kaart_tõmmatud = [False for i in range(52)] > > > mast = ["ärtu", "ruutu", "poti", "risti"] > aste = ["äss", "kaks", "kolm", "neli","viis", "kuus", \ > "seitse", "kahek

Re: Handling 3 operands in an expression without raising an exception

2013-09-27 Thread Νίκος
Στις 27/9/2013 1:43 μμ, ο/η Dave Angel έγραψε: Στις 27/9/2013 1:55 πμ, ο/η Dave Angel έγραψε: Simply assign the default values BEFORE the try block, and use pass as the except block. That still doesn't get around the inadvisability of putting those 3 lines in the try block. You still haven't d

Re: Handling 3 operands in an expression without raising an exception

2013-09-27 Thread Dave Angel
On 27/9/2013 05:19, Νίκος wrote: > Στις 27/9/2013 1:55 πμ, ο/η Dave Angel έγραψε: >> >> Simply assign the default values BEFORE the try block, and use pass as >> the except block. >> >> That still doesn't get around the inadvisability of putting those 3 >> lines in the try block. >> >> You still

card dealer

2013-09-27 Thread markotaht
from random import * from math import floor kaarte_alles = 52 kaart_tõmmatud = [False for i in range(52)] mast = ["ärtu", "ruutu", "poti", "risti"] aste = ["äss", "kaks", "kolm", "neli","viis", "kuus", \ "seitse", "kaheksa", "üheksa", "kümme", "soldat",\ "emand", "kuningas"] de

Re: Handling 3 operands in an expression without raising an exception

2013-09-27 Thread Νίκος
Στις 27/9/2013 12:26 μμ, ο/η Steven D'Aprano έγραψε: On Fri, 27 Sep 2013 12:19:53 +0300, Νίκος wrote: I'am not sure what you mean though when you say: Simply assign the default values BEFORE the try block, and use pass as the except block. Can you please make it more clear for me? variab

Re: What's the best way to extract 2 values from a CSV file from each row systematically?

2013-09-27 Thread Roland Mueller
Hello, 2013/9/24 Alex Lee > Thanks for the help guys! I'll definitely read up on the csv module > documentation. > > Tim, that's incredibly helpful, thanks a lot! :) My CSV file doesn't have > headers, but I'm sure I can just as easily add it in manually. > a better way to provide column header

Re: Handling 3 operands in an expression without raising an exception

2013-09-27 Thread Steven D'Aprano
On Fri, 27 Sep 2013 12:19:53 +0300, Νίκος wrote: > I'am not sure what you mean though when you say: > >> Simply assign the default values BEFORE the try block, and use pass as >> the except block. > > Can you please make it more clear for me? variable = "default value" try: variable = some

Re: Handling 3 operands in an expression without raising an exception

2013-09-27 Thread Νίκος
Στις 27/9/2013 1:55 πμ, ο/η Dave Angel έγραψε: On 26/9/2013 18:14, Νίκος wrote: Στις 26/9/2013 11:16 μμ, ο/η Denis McMahon έγραψε: On Thu, 26 Sep 2013 19:58:02 +0300, Νίκος wrote: except socket.gaierror as e: city = host = "UnKnown Origin" But then what if in case of an error i need

Re: Download all youtube favorites with youtube-dl script

2013-09-27 Thread Thomas Kandler
On 26.09.2013 17:13, Bill wrote: > I have been using the script youtube-dl http://rg3.github.io/youtube-dl/ > > And I was wondering if there is a way to download all of a user's > favorites or uploads. > > The script has a functionality to download all videos in a txt file. So > if there is a way

Method not found: 'ServiceSettingSave' in Suds package

2013-09-27 Thread Anup Kandalkar
I am trying to create service for the url: wsdl_url = https://avatax.avalara.net/Account/Accountsvc.wsdl But some error is coming: svc = suds.client.Client(url=wsdl_url) File "/usr/lib/python2.7/dist-packages/suds/client.py", line 114, in __init__ self.wsdl = reader.open(url) Fil