Re: Can I Import table from txt file into form letter using Python?

2013-02-21 Thread rob . marshall17
Using the data you supplied as is, you could try something like: def print_cities(filename): # cnt is used just to know if it's time for a newline cnt = 0 cities = open(filename,'r').readlines() for city in cities: # Make sure we have a valid population if re.match('\d+$',city.spli

Re: Python Newbie

2013-02-21 Thread rusi
On Feb 22, 3:40 am, piterrr.dolin...@gmail.com wrote: > Thanks to all for quick relies. > > Chris, you are (almost) spot on with the if blocks indentation. This is what > I do, and it has served me well for 15 years. > > code > code > >    if (some condition) >    { >       code >       code >    

Re: Checking for valid date input and convert appropriately

2013-02-21 Thread rob . marshall17
The datetime function: strptime() DOES check the date for validity. So try something like: from datetime import datetime def get_date(): while True: try: date_in = raw_input("Enter date (dd mm ): ") date_out = datetime.strptime(date_in,"%d %m %Y").strftime("%Y-%m-%d")

Re: psycopg2 craziness

2013-02-21 Thread Chris Angelico
On Fri, Feb 22, 2013 at 10:27 AM, wrote: cursor_to.execute("CREATE TABLE foo (id serial PRIMARY KEY);") Like many things, it's silent when everything works. As MRAB suggested, you probably need to commit before the changes become visible; unlike certain other database engines, PostgreSQL ac

Re: NamedTemporaryFile does not match documentation

2013-02-21 Thread Jason Friedman
> Yep, that looks like a docs bug (it was probably copied straight in > from the 2.x docs). Nice and easy to fix, you could submit a patch > with the bug report and make the devs love you! Done: http://bugs.python.org/issue17271. -- http://mail.python.org/mailman/listinfo/python-list

Re: Urllib's urlopen and urlretrieve

2013-02-21 Thread qoresucks
Initially I was just trying the html, but later when I attempted more complicated sites that weren't my own I noticed that large bulks of the site were lost in the process. The urllib code essentially looks like what I was trying but it didn't work as I had expected. To be more specific, after

Re: Python Newbie

2013-02-21 Thread Mitya Sirenef
On 02/21/2013 04:26 PM, Piterrr wrote: Hi folks. > I am a long time C sharp dev, just learning Python now due to job > requirements. My initial impression is that Python has got to be the > most ambiguous and vague language I have seen to date. I have major > issues with the fact that white spac

Re: Checking for valid date input and convert appropriately

2013-02-21 Thread Ferrous Cranus
Τη Παρασκευή, 22 Φεβρουαρίου 2013 2:57:03 π.μ. UTC+2, ο χρήστης Michael Ross έγραψε: > On Fri, 22 Feb 2013 01:12:40 +0100, Ferrous Cranus > wrote: > > Please i have been trying hours for this: > Don't do that: Spending hours on being stuck. Take a break. Call it a > > night. > > Brain nee

Re: NamedTemporaryFile does not match documentation

2013-02-21 Thread Chris Angelico
On Fri, Feb 22, 2013 at 1:10 PM, Jason Friedman wrote: >> NamedTemporaryFile by default opens a file in binary mode ('w+b'). Write >> bytes or specify text mode. >> > f.write(b"Hello World!\n") >> 13 > ft = NamedTemporaryFile('w+', delete=False) > ft.write("Hello World!\n") >> 13 > > T

Re: Exception in thread QueueFeederThread (most likely raised during interpreter shutdown)

2013-02-21 Thread Ziliang Chen
On Thursday, February 21, 2013 2:20:41 AM UTC+8, MRAB wrote: > On 2013-02-20 08:26, Ziliang Chen wrote: > Hi Guys, > I am using the > multiprocessing module. The following code snippet occasionally throws the > "Exception in thread QueueFeederThread (most likely raised during interpreter > shutd

Re: Confusing math problem

2013-02-21 Thread Dave Angel
On 02/21/2013 05:44 PM, Schizoid Man wrote: No, I was aware to be honest. I thought ** was just short hand for math.pow(). Since ** is the integer operation It's an integer operation because you started with two ints. Unlike math.pow, which converts to floats, whatever you feed it. I

Re: NamedTemporaryFile does not match documentation

2013-02-21 Thread Jason Friedman
> NamedTemporaryFile by default opens a file in binary mode ('w+b'). Write > bytes or specify text mode. > f.write(b"Hello World!\n") > 13 ft = NamedTemporaryFile('w+', delete=False) ft.write("Hello World!\n") > 13 Thank you Chris and Serhiy, that helped. I'm inclined to open a doc

Issues a longer xpath expression

2013-02-21 Thread python
I am having issues with the urllib and lxml.html modules. Here is my original code: import urllib import lxml.html down='http://v.163.com/special/visualizingdata/' file=urllib.urlopen(down).read() root=lxml.html.document_fromstring(file) xpath_str="//div[@class='down s-fc3 f-fl']/a" url

Re: Checking for valid date input and convert appropriately

2013-02-21 Thread Michael Ross
On Fri, 22 Feb 2013 01:12:40 +0100, Ferrous Cranus wrote: Please i have been trying hours for this: Don't do that: Spending hours on being stuck. Take a break. Call it a night. Brain needs time to unstick itself. Besides: from datetime import date entry='31 03 2013' day, month,

Re: psycopg2 craziness

2013-02-21 Thread andydtaylor
I'd actually forgotten about commit, thanks! I'll have another go with this in mind. -- http://mail.python.org/mailman/listinfo/python-list

Re: psycopg2 craziness

2013-02-21 Thread MRAB
On 2013-02-21 23:27, andydtay...@gmail.com wrote: Hi, I'm trying to use psycopg2 but having some issues. Would it be possible to get some pointers? I seem unable to execute any SQL statements. So here are my database tables before (and after) I try to do anything: postgres=# \c You are now

Re: Python Newbie

2013-02-21 Thread Chris Angelico
On Fri, Feb 22, 2013 at 10:34 AM, wrote: > Thanks for this. Regarding ambiguity, you will never find me write ambiguous > code. I don't sabotage my own work. But the reality is that in addition to > writing my own code, I have to maintain existing. I find it incredibly > confusing then I see a

Re: Confusing math problem

2013-02-21 Thread Chris Angelico
On Fri, Feb 22, 2013 at 9:44 AM, Schizoid Man wrote: > > No, I was aware to be honest. I thought ** was just short hand for > math.pow(). Since ** is the integer operation, I suppose ^ doesn't work as > an exponent function in Python? ^ is bitwise XOR, completely different. ChrisA -- http://mai

Re: Python scheduler

2013-02-21 Thread Mark Lawrence
On 21/02/2013 04:04, Rita wrote: Hello, Here is what I am trying to do. (Currently, I am doing this in cron but i need much more granularity). I am trying to run program every 20 secs and loop forever. I have several of these types of processes, some should run every 5 mins, 10 secs, 20 secs, 1

Re: Confusing math problem

2013-02-21 Thread Ian Kelly
On Thu, Feb 21, 2013 at 4:41 PM, Schizoid Man wrote: > So how is operator.pow() different from just pow()? math.pow() is a wrapper around the C library function. ** and operator.pow() are the same thing; the latter is just a function version of the former. The built-in pow() is a mutant version

Re: Checking for valid date input and convert appropriately

2013-02-21 Thread Ferrous Cranus
Please i have been trying hours for this: try: datetime.strptime(date, '%d m% %Y') date = date.strftime('%Y-%m-%d') except: print( "date not propetly entered." ) sys.exit(0) === the user enters

Re: Python scheduler

2013-02-21 Thread Rita
Thanks. This is what I was looking for! On Thu, Feb 21, 2013 at 9:48 AM, Adam Tauno Williams wrote: > On Wed, 2013-02-20 at 23:04 -0500, Rita wrote: > > > Here is what I am trying to do. (Currently, I am doing this in cron > > but i need much more granularity). I am trying to run program every

Re: Confusing math problem

2013-02-21 Thread Oscar Benjamin
On 21 February 2013 23:41, Schizoid Man wrote: > "Oscar Benjamin" wrote in >> Then you want operator.pow: >> > import operator > operator.pow(3, 2) >> >> 9 >> >> math.pow is basically the (double)pow(double, double) function from >> the underlying C library. operator.pow(a, b) is precisel

Re: Python Newbie

2013-02-21 Thread Ian Kelly
On Thu, Feb 21, 2013 at 3:40 PM, wrote: > I am nervous about using variables "out of the blue", without having to > declare them. For example, when I write "i = 0" it is perfectly OK to Python > without 'i' being declared earlier. How do I know that I haven't used this > variable earlier and I

Re: Python Newbie

2013-02-21 Thread Mark Lawrence
On 21/02/2013 23:34, piterrr.dolin...@gmail.com wrote: Hi Chris, Thanks for this. Regarding ambiguity, you will never find me write ambiguous code. I don't sabotage my own work. But the reality is that in addition to writing my own code, I have to maintain existing. I find it incredibly confus

Re: Confusing math problem

2013-02-21 Thread Schizoid Man
"Oscar Benjamin" wrote in Then you want operator.pow: import operator operator.pow(3, 2) 9 math.pow is basically the (double)pow(double, double) function from the underlying C library. operator.pow(a, b) is precisely the same as a**b. So how is operator.pow() different from just pow()?

Re: Confusing math problem

2013-02-21 Thread Schizoid Man
"Dave Angel" wrote One other test: diff = set(map(int, result1)).symmetric_difference(set(result2)) if diff: print diff print len(diff) shows me a diff set of 15656 members. One such member: 135525271560688054250931600108742713928222656250

Re: Checking for valid date input and convert appropriately

2013-02-21 Thread Michael Ross
On Fri, 22 Feb 2013 00:08:01 +0100, Ferrous Cranus wrote: Τη Παρασκευή, 22 Φεβρουαρίου 2013 12:03:59 π.μ. UTC+2, ο χρήστης Michael Ross έγραψε: On Thu, 21 Feb 2013 22:22:15 +0100, Ferrous Cranus wrote: > Τη Πέμπτη, 21 Φεβρουαρίου 2013 10:14:13 μ.μ. UTC+2, ο χρήστης MRAB > έγραψε: >

Re: Python Newbie

2013-02-21 Thread piterrr . dolinski
Hi Chris, Thanks for this. Regarding ambiguity, you will never find me write ambiguous code. I don't sabotage my own work. But the reality is that in addition to writing my own code, I have to maintain existing. I find it incredibly confusing then I see a statement along the lines of "if not so

psycopg2 craziness

2013-02-21 Thread andydtaylor
Hi, I'm trying to use psycopg2 but having some issues. Would it be possible to get some pointers? I seem unable to execute any SQL statements. So here are my database tables before (and after) I try to do anything: postgres=# \c You are now connected to database "postgres" as user "postgres"

Re: Python Newbie

2013-02-21 Thread Oscar Benjamin
On 21 February 2013 22:40, wrote: > Thanks to all for quick relies. > > Chris, you are (almost) spot on with the if blocks indentation. This is what > I do, and it has served me well for 15 years. > > code > code > >if (some condition) >{ > code > code >} > > code > code

Re: Checking for valid date input and convert appropriately

2013-02-21 Thread Mark Lawrence
On 21/02/2013 23:18, Ferrous Cranus wrote: Then i try to save the date as MySQL wants but it just aint happening: date = datetime.strftime(date, '%Y-%m-%d') Can you help me please save the user entered date to MySQL format? I suggest testing your code at the interactive prompt, so something

Re: Checking for valid date input and convert appropriately

2013-02-21 Thread Ferrous Cranus
Then i try to save the date as MySQL wants but it just aint happening: date = datetime.strftime(date, '%Y-%m-%d') Can you help me please save the user entered date to MySQL format? -- http://mail.python.org/mailman/listinfo/python-list

Re: Confusing math problem

2013-02-21 Thread Chris Angelico
On Fri, Feb 22, 2013 at 9:33 AM, Dave Angel wrote: > On 02/21/2013 05:11 PM, Chris Angelico wrote: >> >> >>> >> >> >> Note how, in each case, calculating three powers that have the same >> real-number result gives a one-element set. Three to the sixtieth >> power can't be perfectly rendered with

Re: Checking for valid date input and convert appropriately

2013-02-21 Thread Ferrous Cranus
Τη Παρασκευή, 22 Φεβρουαρίου 2013 12:03:59 π.μ. UTC+2, ο χρήστης Michael Ross έγραψε: > On Thu, 21 Feb 2013 22:22:15 +0100, Ferrous Cranus > > wrote: > > > > > Τη Πέμπτη, 21 Φεβρουαρίου 2013 10:14:13 μ.μ. UTC+2, ο χρήστης MRAB > > > έγραψε: > > >> On 2013-02-21 19:38, Ferrous Cranus wro

Re: Confusing math problem

2013-02-21 Thread Oscar Benjamin
On 21 February 2013 22:39, Schizoid Man wrote: > "Dave Angel" wrote in message >> >> On 02/21/2013 02:33 PM, Schizoid Man wrote: >> However, there is an important inaccuracy in math.pow, because it uses >> floats to do the work. If you have very large integers, that means some of >> them won't b

Re: Confusing math problem

2013-02-21 Thread Schizoid Man
"Chris Angelico" wrote in First, are you aware that ** will return int (or sometimes long on 2.7.3), while math.pow() will return a float? That may tell you why you're seeing differences. That said, though, I wasn't able to replicate your result using 2.7.3 and 3.3.0 both on Windows - always

Re: Python Newbie

2013-02-21 Thread piterrr . dolinski
Thanks to all for quick relies. Chris, you are (almost) spot on with the if blocks indentation. This is what I do, and it has served me well for 15 years. code code if (some condition) { code code } code code This is what I call code clarity. With Python, I am having to d

Re: Confusing math problem

2013-02-21 Thread Schizoid Man
"Dave Angel" wrote in message On 02/21/2013 02:33 PM, Schizoid Man wrote: However, there is an important inaccuracy in math.pow, because it uses floats to do the work. If you have very large integers, that means some of them won't be correct. The following are some examples for 2.7.3 on L

Re: Confusing math problem

2013-02-21 Thread Dave Angel
On 02/21/2013 05:11 PM, Chris Angelico wrote: Note how, in each case, calculating three powers that have the same real-number result gives a one-element set. Three to the sixtieth power can't be perfectly rendered with a 53-bit mantissa, but it's rendered the same way whichever route is use

Re: Can I Import table from txt file into form letter using Python?

2013-02-21 Thread accessnewbie
On Thursday, February 21, 2013 2:12:12 PM UTC-8, WorkerBee wrote: > Very new to python but diving in with both feet here. > > > > I am trying to extend a python script to include automating a response form > letter by including the results from a text file in tabular format into the > letter.

Re: Checking for valid date input and convert appropriately

2013-02-21 Thread Michael Ross
On Thu, 21 Feb 2013 22:22:15 +0100, Ferrous Cranus wrote: Τη Πέμπτη, 21 Φεβρουαρίου 2013 10:14:13 μ.μ. UTC+2, ο χρήστης MRAB έγραψε: On 2013-02-21 19:38, Ferrous Cranus wrote: > import datetime from datetime Should be: from datetime import datetime > > try: > datetime.strpt

Re: Python Newbie

2013-02-21 Thread Dave Angel
On 02/21/2013 04:26 PM, Piterrr wrote: Hi folks. I am a long time C sharp dev, just learning Python now due to job requirements. My initial impression is that Python has got to be the most ambiguous and vague language I have seen to date. I have major issues with the fact that white space matt

Re: Can I Import table from txt file into form letter using Python?

2013-02-21 Thread accessnewbie
On Thursday, February 21, 2013 2:12:12 PM UTC-8, WorkerBee wrote: > Very new to python but diving in with both feet here. > > > > I am trying to extend a python script to include automating a response form > letter by including the results from a text file in tabular format into the > letter.

Can I Import table from txt file into form letter using Python?

2013-02-21 Thread WorkerBee
Very new to python but diving in with both feet here. I am trying to extend a python script to include automating a response form letter by including the results from a text file in tabular format into the letter. I have a text file called “Cities” that I want to add to a paragraph in documen

Re: Confusing math problem

2013-02-21 Thread Chris Angelico
On Fri, Feb 22, 2013 at 8:59 AM, Peter Pearson wrote: > On Fri, 22 Feb 2013 08:23:27 +1100, Chris Angelico wrote: >> In theory, a float should hold the nearest representable value to the >> exact result. Considering that only one operation is being performed, >> there should be no accumulation of

Re: Python Newbie

2013-02-21 Thread Peter Pearson
On Thu, 21 Feb 2013 13:26:41 -0800 (PST), Piterrr wrote: > I am a long time C sharp dev, just learning Python now due > to job requirements. My initial impression is that Python > has got to be the most ambiguous and vague language I have > seen to date. I have major issues with the fact that whit

Re: Confusing math problem

2013-02-21 Thread Peter Pearson
On Fri, 22 Feb 2013 08:23:27 +1100, Chris Angelico wrote: > On Fri, Feb 22, 2013 at 7:49 AM, Dave Angel wrote: >> However, if I do: >> >> print 3**60, "\n", int(math.pow(3,60)), "\n", pow(3,60) >> >> >> I get: >> >> 42391158275216203514294433201 >> 42391158275216203520420085760 >> 423911582752162

Re: Python Newbie

2013-02-21 Thread Chris Angelico
On Fri, Feb 22, 2013 at 8:26 AM, Piterrr wrote: > Hi folks. > I am a long time C sharp dev, just learning Python now due to job > requirements. My initial impression is that Python has got to be the most > ambiguous and vague language I have seen to date. I have major issues with > the fact tha

Re: Python Newbie

2013-02-21 Thread MRAB
On 2013-02-21 21:26, Piterrr wrote: Hi folks. I am a long time C sharp dev, just learning Python now due to job requirements. My initial impression is that Python has got to be the most ambiguous and vague language I have seen to date. I have major issues with the fact that white space matters. H

Re: Python Newbie

2013-02-21 Thread Ian Kelly
On Thu, Feb 21, 2013 at 2:26 PM, Piterrr wrote: > I am a long time C sharp dev, just learning Python now due to job > requirements. My initial impression is that Python has got to be the most > ambiguous and vague language I have seen to date. I have major issues with > the fact that white spac

Re: Checking for valid date input and convert appropriately

2013-02-21 Thread MRAB
On 2013-02-21 21:22, Ferrous Cranus wrote: Τη Πέμπτη, 21 Φεβρουαρίου 2013 10:14:13 μ.μ. UTC+2, ο χρήστης MRAB έγραψε: On 2013-02-21 19:38, Ferrous Cranus wrote: > import datetime from datetime Should be: from datetime import datetime > > try: > datetime.strptime( date, '%d %m %Y' ) That

Re: NamedTemporaryFile does not match documentation

2013-02-21 Thread Serhiy Storchaka
On 21.02.13 22:46, Jason Friedman wrote: Python 3.2.2 (default, Feb 14 2012, 08:06:31) [GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2 Type "help", "copyright", "credits" or "license" for more information. from tempfile import NamedTemporaryFile f = NamedTemporaryFile(delete=False) f f.name

Python Newbie

2013-02-21 Thread Piterrr
Hi folks. I am a long time C sharp dev, just learning Python now due to job requirements. My initial impression is that Python has got to be the most ambiguous and vague language I have seen to date. I have major issues with the fact that white space matters. How do you deal with this? For examp

Re: Confusing math problem

2013-02-21 Thread Chris Angelico
On Fri, Feb 22, 2013 at 7:49 AM, Dave Angel wrote: > However, if I do: > > print 3**60, "\n", int(math.pow(3,60)), "\n", pow(3,60) > > > I get: > > 42391158275216203514294433201 > 42391158275216203520420085760 > 42391158275216203514294433201 > > > and the middle one is the one that's wrong. In th

Re: Checking for valid date input and convert appropriately

2013-02-21 Thread Ferrous Cranus
Τη Πέμπτη, 21 Φεβρουαρίου 2013 10:14:13 μ.μ. UTC+2, ο χρήστης MRAB έγραψε: > On 2013-02-21 19:38, Ferrous Cranus wrote: > > > import datetime from datetime > > > > Should be: > > > > from datetime import datetime > > > > > > > > try: > > > datetime.strptime( date, '%d %m %Y' ) > >

Re: Is there a graphical GUI builder?

2013-02-21 Thread Robert Kern
On 2013-02-21 17:05, Roland Koebler wrote: Hi, The situation has not substantively changed, but your description of it is not really accurate. There was and still is a "commercial license" which allows for completely proprietary development without needing to allow end users to relink the appli

Re: Confusing math problem

2013-02-21 Thread Dave Angel
On 02/21/2013 03:25 PM, Dave Angel wrote: a b math.pow(a,b) a**b 3 34 1.66771816997e+16 16677181699666569 3 35 5.0031545099e+16 50031545098999707 ... 5 23 1.19209289551e+16 11920928955078125 The built-in pow, on the other hand, seems to get identical answers for all these

Re: NamedTemporaryFile does not match documentation

2013-02-21 Thread Chris Angelico
On Fri, Feb 22, 2013 at 7:46 AM, Jason Friedman wrote: > Python 3.2.2 (default, Feb 14 2012, 08:06:31) > [GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. from tempfile import NamedTemporaryFile f = NamedTemporaryFi

NamedTemporaryFile does not match documentation

2013-02-21 Thread Jason Friedman
Python 3.2.2 (default, Feb 14 2012, 08:06:31) [GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from tempfile import NamedTemporaryFile >>> f = NamedTemporaryFile(delete=False) >>> f >>> f.name '/tmp/tmpqxnd_4' >>> f.write(

Re: Confusing math problem

2013-02-21 Thread Chris Angelico
On Fri, Feb 22, 2013 at 6:33 AM, Schizoid Man wrote: > Hi there, > > I run the following code in Python 3.3.0 (on a Windows 7 machine) and Python > 2.7.3 on a Mac and I get two different results: > >result1.append(math.pow(a,b)) >result2.append(a**b) First, are you aware that ** w

Re: Confusing math problem

2013-02-21 Thread Ian Kelly
On Thu, Feb 21, 2013 at 12:33 PM, Schizoid Man wrote: > Hi there, > > I run the following code in Python 3.3.0 (on a Windows 7 machine) and Python > 2.7.3 on a Mac and I get two different results: > > result1 = [] > result2 = [] > for a in range(2,101): >for b in range(2,101): >result1

Re: Confusing math problem

2013-02-21 Thread Dave Angel
On 02/21/2013 02:33 PM, Schizoid Man wrote: Hi there, I run the following code in Python 3.3.0 (on a Windows 7 machine) and Python 2.7.3 on a Mac and I get two different results: result1 = [] result2 = [] for a in range(2,101): for b in range(2,101): result1.append(math.pow(a,b))

Re: Checking for valid date input and convert appropriately

2013-02-21 Thread MRAB
On 2013-02-21 19:38, Ferrous Cranus wrote: import datetime from datetime Should be: from datetime import datetime try: datetime.strptime( date, '%d %m %Y' ) That parses the date and discards the result. date = date.strptime( '%Y-%m-%d' ) 'date' is a string, it doesn't have a

Checking for valid date input and convert appropriately

2013-02-21 Thread Ferrous Cranus
import datetime from datetime try: datetime.strptime( date, '%d %m %Y' ) date = date.strptime( '%Y-%m-%d' ) except ValueError: print( "H ημερομηνία πρέπει να εισαχθεί στην σωστή μορφή => 21 05 2013!" ) sys.exit(0) Hello, a have an html that among

Confusing math problem

2013-02-21 Thread Schizoid Man
Hi there, I run the following code in Python 3.3.0 (on a Windows 7 machine) and Python 2.7.3 on a Mac and I get two different results: result1 = [] result2 = [] for a in range(2,101): for b in range(2,101): result1.append(math.pow(a,b)) result2.append(a**b) result1 = list(set(

Re: Urllib's urlopen and urlretrieve

2013-02-21 Thread Dave Angel
On 02/21/2013 07:12 AM, qoresu...@gmail.com wrote: Why is it that when using urllib.urlopen then reading or urllib.urlretrieve, does it only give me parts of the sites, loosing the formatting, images, etc...? How can I get around this? Start by telling us if you're using Python2 or Python

Re: Urllib's urlopen and urlretrieve

2013-02-21 Thread Dave Angel
On 02/21/2013 12:47 PM, rh wrote: On Thu, 21 Feb 2013 10:56:15 -0500 Dave Angel wrote: On 02/21/2013 07:12 AM, qoresu...@gmail.com wrote: I only just started Python and given that I know nothing about network programming or internet programming of any kind really, I thought it would be interes

Re: ** Please Rank These Learning Sources **

2013-02-21 Thread Philipp Hagemeister
> http://learnpythonthehardway.org/book/ I have never used that myself, but I have seeen plenty of stackoverflow and student questions about it. In short, it's horrible. The book mostly consists of basic Python programs, and beginners often fail to grasp even the most basic structures demonstrated

Re: ** Please Rank These Learning Sources **

2013-02-21 Thread Mark Janssen
Sorry, I gave you the wrong book (a different Lutz book). The correct title is _Programming Python_, by Mark Lutz. It's like 1600 pages and is application focused. Cheers! mark -- http://mail.python.org/mailman/listinfo/python-list

Re: ** Please Rank These Learning Sources **

2013-02-21 Thread Mark Janssen
On Thu, Feb 21, 2013 at 2:08 AM, Claira wrote: > The problem: I've done reading (like on quora), and it seems lots of > beginners (and I know first-hand for me), and even for those that have done > 4 years at university -- that they say they don't know how to build > something after all the theory

Re: Is there a graphical GUI builder?

2013-02-21 Thread Roland Koebler
Hi, > The situation has not substantively changed, but your description of > it is not really accurate. There was and still is a "commercial > license" which allows for completely proprietary development without > needing to allow end users to relink the application against > user-supplied version

Re: PyQT app accessible over network?

2013-02-21 Thread Michael Torrie
On 02/21/2013 09:22 AM, Monte Milanuk wrote: > What I was wondering is what would be a good way of handling this with a > PyQt app? Build the desktop app first, and add some sort of > functionality to enable a lightweight web server and framework for the > additional data entry 'clients'? Or

PyQT app accessible over network?

2013-02-21 Thread Monte Milanuk
Hello all, New guy here, with a kind of general question. Hopefully its not too silly... I've been working at learning python off and on now for a while, with a couple programs in mind as a goal - kind of specialized stuff that I can't seem to find a good match for already available, compet

Re: Urllib's urlopen and urlretrieve

2013-02-21 Thread Dave Angel
On 02/21/2013 07:12 AM, qoresu...@gmail.com wrote: I only just started Python and given that I know nothing about network programming or internet programming of any kind really, I thought it would be interesting to try write something that could create an archive of a website for myself. Ple

Re: Transparent Proxy and Redirecting Sockets

2013-02-21 Thread Luca Bongiorni
2013/2/21 Rodrick Brown > On Thu, Feb 21, 2013 at 10:24 AM, Luca Bongiorni wrote: > >> Hi all, >> Around I have found plenty useful sources about TCP transparent proxies. >> However I am still missing how to make socket redirection. >> >> What I would like to do is: >> >> host_A <--> PROXY <--> h

Re: Is Python "venerable"?

2013-02-21 Thread Gene Heskett
On Wednesday 20 February 2013 10:32:14 Albert Hopkins did opine: > On Tue, Feb 19, 2013, at 11:10 PM, Gene Heskett wrote: > [...] > > > And even us old (78) farts are calling things Kewl now. > > 78??? Is that the year you were born or the years since you were born? > > -a Born in Oct 1934. 7

Re: Transparent Proxy and Redirecting Sockets

2013-02-21 Thread Rodrick Brown
On Thu, Feb 21, 2013 at 10:24 AM, Luca Bongiorni wrote: > Hi all, > Around I have found plenty useful sources about TCP transparent proxies. > However I am still missing how to make socket redirection. > > What I would like to do is: > > host_A <--> PROXY <--> host_B > ^ >

Transparent Proxy and Redirecting Sockets

2013-02-21 Thread Luca Bongiorni
Hi all, Around I have found plenty useful sources about TCP transparent proxies. However I am still missing how to make socket redirection. What I would like to do is: host_A <--> PROXY <--> host_B ^ | host_C <-- At the beginning the proxy is simply forwarding th

Re: Python scheduler

2013-02-21 Thread Adam Tauno Williams
On Wed, 2013-02-20 at 23:04 -0500, Rita wrote: > Here is what I am trying to do. (Currently, I am doing this in cron > but i need much more granularity). I am trying to run program every 20 > secs and loop forever. I have several of these types of processes, > some should run every 5 mins, 10 secs

Re: What am I doing wrong installing Python 2.7.3?

2013-02-21 Thread Michael Herman
I assume you have admin privileges on your computer, correct? On Thu, Feb 21, 2013 at 6:39 AM, Etherus wrote: > I have downloaded the windows installer for a 32 bit installation of > python 2.7.3 but it tells me that: > > The feature you are trying to use is on a network resource that is > unava

Re: What am I doing wrong installing Python 2.7.3?

2013-02-21 Thread Tim Golden
On 21/02/2013 14:39, Etherus wrote: > I have downloaded the windows installer for a 32 bit installation of > python 2.7.3 but it tells me that: > > The feature you are trying to use is on a network resource that is > unavailable. > > Click OK to try again, or enter an alternative path to a folder

What am I doing wrong installing Python 2.7.3?

2013-02-21 Thread Etherus
I have downloaded the windows installer for a 32 bit installation of python 2.7.3 but it tells me that: The feature you are trying to use is on a network resource that is unavailable. Click OK to try again, or enter an alternative path to a folder containing the installation package python 2.7.

Re: pypi changelog api

2013-02-21 Thread Michael Herman
yeah, i just checked github, i thought a buddy of mine had submitted an issue not sure how they get their updates. this is an interesting project - https://github.com/kencochrane/pypi-mirrors On Thu, Feb 21, 2013 at 6:04 AM, Philipp Hagemeister wrote: > Just FYI, PyPi already has an RSS feed: >

Re: pypi changelog api

2013-02-21 Thread Michael Herman
totally agree. if you just had a listener setup you could just have a simple trigger-action setup. On Thu, Feb 21, 2013 at 6:07 AM, Philipp Hagemeister wrote: > On 02/21/2013 02:58 PM, Michael Herman wrote: > > Oh - and I haven't tried this site, but you may be able to set something > up > > on t

why can not parse the web in almost same xpath expression?

2013-02-21 Thread python
import urllib import lxml.html down='http://v.163.com/special/visualizingdata/' file=urllib.urlopen(down).read() root=lxml.html.document_fromstring(file) urllist=root.xpath('//div[@class="down s-fc3 f-fl"]//a') for url in urllist: print url.get("href") i get

Re: pypi changelog api

2013-02-21 Thread Philipp Hagemeister
On 02/21/2013 02:58 PM, Michael Herman wrote: > Oh - and I haven't tried this site, but you may be able to set something up > on there to email when the changelog is updated. > > http://www.changedetection.com/ They just query the whole page - I could do that myself, easily. But the problem is tha

Re: pypi changelog api

2013-02-21 Thread Philipp Hagemeister
Just FYI, PyPi already has an RSS feed: https://pypi.python.org/pypi?:action=rss And instead of mailing the author, you should probably open an issue (or better yet, a pull request) at https://github.com/crateio/crate.web/issues For that matter - how does crate.io update their PyPi mirror? Cheer

Re: pypi changelog api

2013-02-21 Thread Michael Herman
Oh - and I haven't tried this site, but you may be able to set something up on there to email when the changelog is updated. http://www.changedetection.com/ On Thu, Feb 21, 2013 at 5:52 AM, Michael Herman wrote: > I'd love to see https://crate.io/ set up an API or at the very least an > RSS fee

Re: pypi changelog api

2013-02-21 Thread Michael Herman
I'd love to see https://crate.io/ set up an API or at the very least an RSS feed for tracking changes. I've emailed the author about this. I think if enough people do, an RSS feed would be easy to setup. On Thu, Feb 21, 2013 at 5:33 AM, Philipp Hagemeister wrote: > Hi Gregg, > > to get a smaller

Re: pypi changelog api

2013-02-21 Thread Philipp Hagemeister
Hi Gregg, to get a smaller response, you can simply pass in a timestamp, like this: >>> client = xmlrpclib.ServerProxy('http://pypi.python.org/pypi') >>> import time >>> client.changelog(int(time.time() - 600)) [['vs.bootstrap.plonetheme', '1.0.1', 1361451748, 'update description, classifiers'],

PyPyODBC 1.0 (Pure Python ODBC) released with Python 3.3 support

2013-02-21 Thread 江文
PyPyODBC, the single script Python ODBC module, now runs under both Python 2.x and Python 3.3 PyPyODBC - A Pure Python ctypes ODBC module > > Features > >- *One pure Python script, runs on CPython / > IronPython > / PyPy , Version 2.4 /

Re: Urllib's urlopen and urlretrieve

2013-02-21 Thread Michael Herman
Are you just trying to get the html? If so, you can use this code- *import urllib* * * *# fetch the and download a webpage, nameing it test.html* *urllib.urlretrieve("http://www.web2py.com/";, filename="test.html")* I recommend using the requests library, as it's easier to use and more powerful:

Urllib's urlopen and urlretrieve

2013-02-21 Thread qoresucks
I only just started Python and given that I know nothing about network programming or internet programming of any kind really, I thought it would be interesting to try write something that could create an archive of a website for myself. With this I started trying to use the urllib library, howe

Re: Python scheduler

2013-02-21 Thread Rita
Thanks for the replies. Its also important for me to have asynchronous abilities. I will be running some programs which will be taking much longer (1-2 minutes) and I don't want others to be blocked. On Thu, Feb 21, 2013 at 2:35 AM, Chris Rebert wrote: > On Wed, Feb 20, 2013 at 8:04 PM, Rita

Re: Is there a graphical GUI builder?

2013-02-21 Thread Robert Kern
On 2013-02-21 10:18, Steve Simmons wrote: On 21/02/2013 11:08, Chris Angelico wrote: On Thu, Feb 21, 2013 at 8:20 PM, PythonAB wrote: On 21 feb 2013, at 04:45, Michael Torrie wrote: On 02/20/2013 12:44 AM, Steve Simmons wrote: 2. Qt isn't 'free' (depending on what you are going to be doing

Re: Help me debug this script with argparse and if statements

2013-02-21 Thread Chris Angelico
On Thu, Feb 21, 2013 at 9:56 PM, Santosh Kumar wrote: >> To do what you're looking for there, I wouldn't bother with argparse >> at all - I'd just look at sys.argv[1] for the word you're looking for. >> Yes, it'd be a bit strict and simplistic, but by the look of things, >> you don't need sophisti

Re: Help me debug this script with argparse and if statements

2013-02-21 Thread Santosh Kumar
> To do what you're looking for there, I wouldn't bother with argparse > at all - I'd just look at sys.argv[1] for the word you're looking for. > Yes, it'd be a bit strict and simplistic, but by the look of things, > you don't need sophistication. You are right, but I think sys.argv is very basic.

Re: Help me debug this script with argparse and if statements

2013-02-21 Thread Peter Otten
Chris Angelico wrote: > On Thu, Feb 21, 2013 at 9:05 PM, Santosh Kumar > wrote: >> parser.add_argument( >> 'install', >> nargs='?', >> help='install myapp' >> ) >> >> parser.add_argument( >> 'uninstall', >> nargs='?', >> help='uninstall myapp' >> ) >> >> args = par

Re: Is there a graphical GUI builder?

2013-02-21 Thread Roland Koebler
Hi, > How so? It's LGPL. You can't get much freer than that. you can -- MIT/BSD/public domain etc. provide much more freedom to the developer. (And I prefer freedom for the developer over the guarantee (freedom or restriction -- call it as you wish) that nobody may lock down a copy of the sourceco

  1   2   >