Re: python file synchronization

2012-02-07 Thread Sherif Shehab Aldin
Hi Cameron, Thanks a lot for your help, I just forgot to state that the FTP server is not under my command, I can't control how the file grow, or how the records are added, I can only login to It, copy the whole file. The reason why I am parsing the file and trying to get the diffs between the ne

Issue with Scrapping Data from a webpage- Noob Question

2012-02-07 Thread abhijeet mahagaonkar
Hi Fellow Pythoners, I'm trying to collect table data from an authenticated webpage (Tool) to which I have access. I will have the required data after 'click'ing a submit button on the tool homepage. When I inspect the submit button i see Thus the tool's homepage is of the form www.example.com/

Re: turbogears 1

2012-02-07 Thread Steven D'Aprano
On Wed, 08 Feb 2012 00:33:55 -0500, Roy Smith wrote: > In article , > anon hung wrote: > >> Hey guys, someone asked me to maintain his old website, trouble is, >> it's in python, more trouble is it's in turbogears 1. I'm not fluent in >> python but all right, I can learn, but this turbogears th

Re: PyCrypto builds neither with MSVC nor MinGW

2012-02-07 Thread Alec Taylor
Thanks all for your replies. I have now installed MSVC8 and YASM. I was able to successfully run configure.bat and make.bat (including make.bat check). However, I'm unsure what to do about install, since there is no install arg. Do I copy it across to my VC\bin folder, or does it need it's own p

Re: turbogears 1

2012-02-07 Thread Roy Smith
In article , anon hung wrote: > Hey guys, someone asked me to maintain his old website, trouble is, > it's in python, more trouble is it's in turbogears 1. I'm not fluent > in python but all right, I can learn, but this turbogears > thing.. > > First of all, is it still alive? Looks lik

turbogears 1

2012-02-07 Thread anon hung
Hey guys, someone asked me to maintain his old website, trouble is, it's in python, more trouble is it's in turbogears 1. I'm not fluent in python but all right, I can learn, but this turbogears thing.. First of all, is it still alive? Looks like turbogears 2 is the most recent version but

Re: python file synchronization

2012-02-07 Thread Cameron Simpson
On 07Feb2012 01:33, silentnights wrote: | I have the following problem, I have an appliance (A) which generates | records and write them into file (X), the appliance is accessible | throw ftp from a server (B). I have another central server (C) that | runs a Django App, that I need to get continuo

Re: when to use import statements in the header, when to use import statements in the blocks where they are used?

2012-02-07 Thread Dave Angel
You forgot to include the list in your reply, so I'm forwarding it for you. One way you could have done it was to reply-all. On 02/07/2012 09:32 PM, Patto wrote: Dave Angel: On Wed, Feb 8, 2012 at 10:05 AM, Dave Angel wrote: On 02/07/2012 08:48 PM, Lei Cheng wrote: Hi all, In a py

Re: when to use import statements in the header, when to use import statements in the blocks where they are used?

2012-02-07 Thread Patto
Dave Angel: On Wed, Feb 8, 2012 at 10:05 AM, Dave Angel wrote: > On 02/07/2012 08:48 PM, Lei Cheng wrote: > >> Hi all, >> >>In a py file, when to use import statements in the header, when to use >> import statements in the blocks where they are used? >>What are the best practices? >>

Re: when to use import statements in the header, when to use import statements in the blocks where they are used?

2012-02-07 Thread Dave Angel
On 02/07/2012 08:48 PM, Lei Cheng wrote: Hi all, In a py file, when to use import statements in the header, when to use import statements in the blocks where they are used? What are the best practices? Thanks! Pat Best practice is to put all the imports at the beginning of the modu

Re: Cycle around a sequence

2012-02-07 Thread Christoph Hansen
Mark Lawrence schrieb: I'm looking at a way of cycling around a sequence i.e. starting at some given location in the middle of a sequence and running to the end before coming back to the beginning and running to the start place. About the best I could come up with is the following, any better id

Re: iterating over list with one mising value

2012-02-07 Thread Steven D'Aprano
(Apologies in advance for breaking threading, but the original post in this thread doesn't appear for me.) > On Tue, Feb 7, 2012 at 5:27 AM, Sammy Danso > wrote: >> >> Hello experts, >> I am having trouble accessing the content of my list. my list content >> has 2-pair value with the exception o

when to use import statements in the header, when to use import statements in the blocks where they are used?

2012-02-07 Thread Lei Cheng
Hi all, In a py file, when to use import statements in the header, when to use import statements in the blocks where they are used? What are the best practices? Thanks! Pat -- http://mail.python.org/mailman/listinfo/python-list

Re: Cycle around a sequence

2012-02-07 Thread Terry Reedy
On 2/7/2012 8:10 PM, Mark Lawrence wrote: I'm looking at a way of cycling around a sequence i.e. starting at some given location in the middle of a sequence and running to the end before coming back to the beginning and running to the start place. About the best I could come up with is the follow

Re: keeping twisted and wxPython in sync

2012-02-07 Thread crow
On Feb 8, 2:41 am, "Littlefield, Tyler" wrote: > Hello all: > I have a couple questions. First, is there a way to know if connectTCP > failed? I am writing a client with Twisted and would like to be able to > notify the user if they couldn't connect. > Second, I set the protocol on my factory afte

Re: keeping twisted and wxPython in sync

2012-02-07 Thread crow
On Feb 8, 2:41 am, "Littlefield, Tyler" wrote: > Hello all: > I have a couple questions. First, is there a way to know if connectTCP > failed? I am writing a client with Twisted and would like to be able to > notify the user if they couldn't connect. > Second, I set the protocol on my factory afte

Cycle around a sequence

2012-02-07 Thread Mark Lawrence
I'm looking at a way of cycling around a sequence i.e. starting at some given location in the middle of a sequence and running to the end before coming back to the beginning and running to the start place. About the best I could come up with is the following, any better ideas for some definiti

Re: convert perl-script for voltcraft voltmeter to python [newbie]

2012-02-07 Thread Dietmar Schwertberger
Am 03.02.2012 14:11, schrieb Jean Dupont: As my request might have been too much asked, I have started doing some coding myself. I'm in doubt about the readline statement -which doesn't show anything received- as the meter sends continuously streams of 11 bytes Is there a way to just monitor with

Re: pySerial question, setting certain serial parameters [newbie]

2012-02-07 Thread Peter
On Feb 4, 11:47 pm, Jean Dupont wrote: > I need to set the following options I found in a Perl-script in Python for > serial communication with a device (a voltmeter): > > $port->handshake("none"); > $port->rts_active(0); > $port->dtr_active(1); > > I have thus far the following  statements but I

Re: PythonWin debugger holds onto global logging objects too long

2012-02-07 Thread Mark Hammond
On 7/02/2012 9:48 PM, Jean-Michel Pichavant wrote: Vinay Sajip wrote: On Jan 24, 2:52 pm, Rob Richardson wrote: I use PythonWin to debug the Python scripts we write. Our scripts often use the log2pyloggingpackage. When running the scripts inside the debugger, we seem to get oneloggingobject fo

Re: iterating over list with one mising value

2012-02-07 Thread Arnaud Delobelle
On 7 February 2012 22:57, Dennis Lee Bieber wrote: > On Tue, 7 Feb 2012 21:37:20 +, Arnaud Delobelle > wrote: > > >> >>Your list is flat so the unpacking fails.  For it to work, you need >>your list to be of the form: >> >>    wordFreq2 = [('with', 3), ('which', 1), ('were', 2), ('well', 1)]

Re: iterating over list with one mising value

2012-02-07 Thread Aaron France
On 02/07/2012 11:09 PM, Mark Lawrence wrote: On 07/02/2012 21:25, Aaron France wrote: for i in range(0, len(x), 2): print x[i-1], x[i] x = ['with', 3, 'which', 1, 'were', 2, 'well', 1, 'water', 1, 'was', 4, 'two', 1, 'to', 2, 'through', 1, 'thlabour', 1, 'these', 1, 'theat', 1, 'the', 8, '

Re: iterating over list with one mising value

2012-02-07 Thread Mark Lawrence
On 07/02/2012 21:25, Aaron France wrote: for i in range(0, len(x), 2): print x[i-1], x[i] x = ['with', 3, 'which', 1, 'were', 2, 'well', 1, 'water', 1, 'was', 4, 'two', 1, 'to', 2, 'through', 1, 'thlabour', 1, 'these', 1, 'theat', 1, 'the', 8, 'tetanus', 1, 'started', 1, 'size', 1, 'scent',

Re: iterating over list with one mising value

2012-02-07 Thread Arnaud Delobelle
On 7 February 2012 20:23, Sammy Danso wrote: > > Hi Expert, > Thanks for your responses and help. thought I should provide more information > for clarity. Please don't top-post. > Please find the error message below for more information > >    for (key, value) in wordFreq2: > ValueError: need m

Re: iterating over list with one mising value

2012-02-07 Thread Chris Angelico
On Wed, Feb 8, 2012 at 8:25 AM, Aaron France wrote: > for i in range(0, len(x), 2): >    print x[i-1], x[i] I think you want x[i], x[i+1] here, but in any case, this is a fairly standard non-Python way to do this sort of thing. There's a variety of more Pythonic ways to loop, but every now and th

Re: iterating over list with one mising value

2012-02-07 Thread Tim Chase
Thanks for your responses and help. thought I should provide more information for clarity. It sounds like you want the "grouper" function as defined here: http://docs.python.org/library/itertools.html#recipes which does what you describe. -tkc -- http://mail.python.org/mailman/listinfo/pyth

Re: iterating over list with one mising value

2012-02-07 Thread Aaron France
On 02/07/2012 10:13 PM, MRAB wrote: On 07/02/2012 20:23, Sammy Danso wrote: Hi Expert, Thanks for your responses and help. thought I should provide more information for clarity. > Please find the error message below for more information for (key, value) in wordFreq2: ValueError: need more

Re: iterating over list with one mising value

2012-02-07 Thread MRAB
On 07/02/2012 20:23, Sammy Danso wrote: Hi Expert, Thanks for your responses and help. thought I should provide more information for clarity. > Please find the error message below for more information for (key, value) in wordFreq2: ValueError: need more than 1 value to unpack this is a sam

Re: iterating over list with one mising value

2012-02-07 Thread Dave Angel
On 02/07/2012 03:23 PM, Sammy Danso wrote: Please don't top-post. It hopelessly mixes responses out of order. Hi Expert, Thanks for your responses and help. thought I should provide more information for clarity. Please find the error message below for more information for (key, value)

Re: iterating over list with one mising value

2012-02-07 Thread Sammy Danso
Hi Expert, Thanks for your responses and help. thought I should provide more information for clarity.   Please find the error message below for more information      for (key, value) in wordFreq2: ValueError: need more than 1 value to unpack   this is a sample of my data   ['with', 3, '

Re: Reading files in from the proper directory

2012-02-07 Thread Peter Otten
smac2...@comcast.net wrote: > xls_files = glob.glob(in_dir + "*.xls") Try changing that to pattern = os.path.join(in_dir, "*.xls") xls_files = glob.glob(pattern) os.path.join() inserts a (back)slash between directory and filename if necessary. > merge_xls(in_dir="C:\Documents and Settings\

Re: Reading files in from the proper directory

2012-02-07 Thread John Gordon
In <9bfb3e39-2bc6-4399-90cc-1c53aa062...@h6g2000yqk.googlegroups.com> smac2...@comcast.net writes: > xls_files = glob.glob(in_dir + "*.xls") You may want to put a directory separator character in between the directory name and the filename glob pattern. -- John Gordon A

Re: convert perl-script for voltcraft voltmeter to python [newbie]

2012-02-07 Thread Rick Johnson
On Feb 7, 11:44 am, Dennis Lee Bieber wrote: > > [...] > >         Well, since readline() pretty much by definition wants a line-ending > character before returning, it obviously won't work. (Side comment: > readline() isn't even shown as part of the basic Serial class -- it is > in a class FileLi

Re: Reading files in from the proper directory

2012-02-07 Thread John Gordon
In smac2...@comcast.net writes: > Am I correct in thinking that I need to change the current working > directory to this folder in order for Python to read in these files, > then generate my output? You don't have to do it that way, no. In general, when opening a file, you can do it two ways:

Re: Reading files in from the proper directory

2012-02-07 Thread SMac2347
On Feb 7, 1:40 pm, Dave Angel wrote: > On 02/07/2012 01:14 PM, smac2...@comcast.net wrote:> Hello. I am admittedly a > Python novice, and ran into some trouble > > trying to write a program that will pull multiple excel files all into > > one file, with each file on a different sheet. > > > I am

Re: convert perl-script for voltcraft voltmeter to python [newbie]

2012-02-07 Thread Jean Dupont
On 7 feb, 05:21, Terry Reedy wrote: > On 2/2/2012 3:57 PM, Jean Dupont wrote: > > > I'd like to read in the output of a voltcraft vc960 voltmeter > > connected to a usb-port. > > I found the perl-script below but I'd like to accomplish the same with > > python: > > The script below is for an old-f

Re: Reading files in from the proper directory

2012-02-07 Thread SMac2347
Thanks for the responses. Below is the code I have thus far. while the program runs glitch-free, it only results in the printing of the message: "NOTE *** No xls files in C:/Documents and Settings/smacdon/." as specified by my code. Any idea as to why it might be unable to find the .xls documents

Re: Reading files in from the proper directory

2012-02-07 Thread Peter Otten
smac2...@comcast.net wrote: > Hello. I am admittedly a Python novice, and ran into some trouble > trying to write a program that will pull multiple excel files all into > one file, with each file on a different sheet. > > I am confident most of the code is correct, as the program runs > without a

keeping twisted and wxPython in sync

2012-02-07 Thread Littlefield, Tyler
Hello all: I have a couple questions. First, is there a way to know if connectTCP failed? I am writing a client with Twisted and would like to be able to notify the user if they couldn't connect. Second, I set the protocol on my factory after a connection has been made. So when I send my user a

Re: Reading files in from the proper directory

2012-02-07 Thread Dave Angel
On 02/07/2012 01:14 PM, smac2...@comcast.net wrote: Hello. I am admittedly a Python novice, and ran into some trouble trying to write a program that will pull multiple excel files all into one file, with each file on a different sheet. I am confident most of the code is correct, as the program r

Reading files in from the proper directory

2012-02-07 Thread SMac2347
Hello. I am admittedly a Python novice, and ran into some trouble trying to write a program that will pull multiple excel files all into one file, with each file on a different sheet. I am confident most of the code is correct, as the program runs without any errors and I found the base of it onli

Re: how to read serial stream of data [newbie]

2012-02-07 Thread Antti J Ylikoski
On 7.2.2012 16:02, Peter Otten wrote: Antti J Ylikoski wrote: On 7.2.2012 14:13, Jean Dupont wrote: ser2 = serial.Serial(voltport, 2400, 8, serial.PARITY_NONE, 1, rtscts=0, dsrdtr=0, timeout=15) In Python, if you want to continue the source line into the next text line, you must end the line

Re: iterating over list with one mising value

2012-02-07 Thread Tim Chase
On 02/07/12 09:34, Rick Johnson wrote: On Feb 7, 8:46 am, Dave Angel wrote: On 02/07/2012 07:27 AM, Sammy Danso wrote:> Hello experts, I am having trouble accessing the content of my list. my list content has 2-pair value with the exception of one which has single value. here is an example [

Re: iterating over list with one mising value

2012-02-07 Thread Ian Kelly
On Tue, Feb 7, 2012 at 5:27 AM, Sammy Danso wrote: > > Hello experts, > I am having trouble accessing the content of my list. > my list content has 2-pair value with the exception of one which has single > value. here is an example  ['a', 1, 'b', 1, 'c', 3, 'd'] > > I am unable to iterate through

Re: iterating over list with one mising value

2012-02-07 Thread Rick Johnson
On Feb 7, 8:46 am, Dave Angel wrote: > On 02/07/2012 07:27 AM, Sammy Danso wrote:> Hello experts, > > I am having trouble accessing the content of my list. > > my list content has 2-pair value with the exception of one which has single > > value. here is an example  ['a', 1, 'b', 1, 'c', 3, 'd']

Re: difference between random module in python 2.6 and 3.2?

2012-02-07 Thread Ulrich Eckhardt
Am 06.02.2012 09:45, schrieb Matej Cepl: Also, how could I write a re-implementation of random.choice which would work same on python 2.6 and python 3.2? It is not only matter of unit tests, but I would really welcome if the results on both versions produce the same results. Two approaches come

smart baba new year special offer

2012-02-07 Thread Smart Baba
Smart Baba special limited offer. We are the only world lowest-cost, yet professional and elegant-designing website developing company. Follow us for further details: www.websitedeals.com -- http://mail.python.org/mailman/listinfo/python-list

Re: how to read serial stream of data [newbie]

2012-02-07 Thread Jean Dupont
On 7 feb, 15:04, Heiko Wundram wrote: > Am 07.02.2012 14:48, schrieb Antti J Ylikoski: > > > On 7.2.2012 14:13, Jean Dupont wrote: > >> ser2 = serial.Serial(voltport, 2400, 8, serial.PARITY_NONE, 1, > >> rtscts=0, dsrdtr=0, timeout=15) > > > In Python, if you want to continue the source line into

Re: iterating over list with one mising value

2012-02-07 Thread Dave Angel
On 02/07/2012 07:27 AM, Sammy Danso wrote: Hello experts, I am having trouble accessing the content of my list. my list content has 2-pair value with the exception of one which has single value. here is an example ['a', 1, 'b', 1, 'c', 3, 'd'] I am unable to iterate through list to access in

Re: how to read serial stream of data [newbie]

2012-02-07 Thread Heiko Wundram
Am 07.02.2012 14:48, schrieb Antti J Ylikoski: On 7.2.2012 14:13, Jean Dupont wrote: ser2 = serial.Serial(voltport, 2400, 8, serial.PARITY_NONE, 1, rtscts=0, dsrdtr=0, timeout=15) In Python, if you want to continue the source line into the next text line, you must end the line to be continued

Re: how to read serial stream of data [newbie]

2012-02-07 Thread Peter Otten
Antti J Ylikoski wrote: > On 7.2.2012 14:13, Jean Dupont wrote: >> ser2 = serial.Serial(voltport, 2400, 8, serial.PARITY_NONE, 1, >> rtscts=0, dsrdtr=0, timeout=15) > > In Python, if you want to continue the source line into the next text > line, you must end the line to be continued with a backs

Re: how to read serial stream of data [newbie]

2012-02-07 Thread Antti J Ylikoski
On 7.2.2012 14:13, Jean Dupont wrote: ser2 = serial.Serial(voltport, 2400, 8, serial.PARITY_NONE, 1, rtscts=0, dsrdtr=0, timeout=15) In Python, if you want to continue the source line into the next text line, you must end the line to be continued with a backslash '\'. So you should write: s

Re: Static HTML documentation from docstrings

2012-02-07 Thread Chris Rebert
On Tue, Feb 7, 2012 at 4:11 AM, Florian Weimer wrote: > I'm slightly confused about docstrings and HTML documentation.  I used > to think that the library reference was (in part) generated from the > source code, but this does not seem to be the case. > > Is there any tool support for keeping docu

iterating over list with one mising value

2012-02-07 Thread Sammy Danso
Hello experts, I am having trouble accessing the content of my list. my list content has 2-pair value with the exception of one which has single value. here is an example  ['a', 1, 'b', 1, 'c', 3, 'd']   I am unable to iterate through list to access invidual value pairs   I get an error message s

Static HTML documentation from docstrings

2012-02-07 Thread Florian Weimer
I'm slightly confused about docstrings and HTML documentation. I used to think that the library reference was (in part) generated from the source code, but this does not seem to be the case. Is there any tool support for keeping documentation and code in sync? -- http://mail.python.org/mailman/l

Re: how to read serial stream of data [newbie]

2012-02-07 Thread Jean Dupont
On 7 feb, 06:07, Roy Smith wrote: > In article > , >  Jean Dupont wrote: > > > I'd like to read in a stream of data which looks like this: > > the device sends out a byte-string of 11 bytes roughly every second: > > >     B0B0B0B0B03131B0B50D8A > >     B0B0B0B0B03131B0B50D8A > >     B0B0B031B6313

Re: PythonWin debugger holds onto global logging objects too long

2012-02-07 Thread Jean-Michel Pichavant
Vinay Sajip wrote: On Jan 24, 2:52 pm, Rob Richardson wrote: I use PythonWin to debug the Python scripts we write. Our scripts often use the log2pyloggingpackage. When running the scripts inside the debugger, we seem to get oneloggingobject for every time we run the script. The result i

Re: difference between random module in python 2.6 and 3.2?

2012-02-07 Thread Serhiy Storchaka
07.02.12 00:06, Matej Cepl написав(ла): > return seq[int(random.random() * len(seq))] > > doesn't seem like something so terrible (and maintenance intense). :) _choice('abc') returns 'a' with probability P('a') = 1501199875790165/4503599627370496 = 1/3 - 1/13510798882111488 and 'b' with probabi

python file synchronization

2012-02-07 Thread silentnights
Hi All, I have the following problem, I have an appliance (A) which generates records and write them into file (X), the appliance is accessible throw ftp from a server (B). I have another central server (C) that runs a Django App, that I need to get continuously the records from file (A). The pro

Re: Python and TAP

2012-02-07 Thread Matej Cepl
On 7.2.2012 04:24, alex23 wrote: Experience? Are you seriously advocating something for which you've done nothing more than watch a podcast? No, I am not. If you reread my original post, you may find that I was asking exactly for experience and explanation why something which seems to me obv