Re: iterating over a file with two pointers

2013-09-19 Thread Joshua Landau
Although "tee" is most certainly preferable because IO is far slower than the small amounts of memory "tee" will use, you do have this option: def iterate_file_lines(file): """ Iterate over lines in a file, unlike normal iteration this allows seeking. """

Re: iterating over a file with two pointers

2013-09-19 Thread Peter Otten
Roy Smith wrote: >> Dave Angel wrote (and I agreed with): >>> I'd suggest you open the file twice, and get two file objects. Then you >>> can iterate over them independently. > > > On Sep 18, 2013, at 9:09 AM, Oscar Benjamin wrote: >> There's no need to use OS resources by opening the file twi

Re: linregress and polyfit

2013-09-19 Thread chitturk
tried (1,) - still same error ... printed "z" and looks right, len(z) OK (puzzling) -- https://mail.python.org/mailman/listinfo/python-list

Re: subprocess call is not waiting.

2013-09-19 Thread harish.barve...@gmail.com
subprocess.call(tempFileName, shell=True).communicate() this process is not blocking. I want to make a blocking call to it. please help -- https://mail.python.org/mailman/listinfo/python-list

Re: scipy 11 and scipy 12

2013-09-19 Thread Oscar Benjamin
On 19 September 2013 03:42, Steven D'Aprano wrote: >> For Python 2.7 I think that easy_install will be able to install from >> the sourceforge binaries, e.g >> >> easy_install --user scipy >> >> but I may be wrong. I should add that I meant the above as a suggestion for a Windows user. > If

Re: iterating over a file with two pointers

2013-09-19 Thread Oscar Benjamin
On 19 September 2013 08:23, Peter Otten <__pete...@web.de> wrote: > Roy Smith wrote: >> >> I believe by "Peter's version", you're talking about: >> >>> from itertools import islice, tee >>> >>> with open("tmp.txt") as f: >>> while True: >>> for outer in f: >>> print outer, >

Re: linregress and polyfit

2013-09-19 Thread Oscar Benjamin
On 18 September 2013 20:57, Dave Angel wrote: > On 18/9/2013 09:38, chitt...@uah.edu wrote: > >> Thanks - that helps ... but it is puzzling because >> >> np.random.normal(0.0,1.0,1) returns exactly one >> and when I checked the length of "z", I get 21 (as before) ... >> >> > > I don't use Numpy, s

Re: iterating over a file with two pointers

2013-09-19 Thread Peter Otten
Oscar Benjamin wrote: > $ cat tee.py > #!/usr/bin/env python > > import sys > from itertools import tee > > items = iter(range(int(sys.argv[1]))) > > while True: > for x in items: > items, discard = tee(items) > break > else: > break > > print(x) > > $ time py

Re: Stripping characters from windows clipboard with win32clipboard from excel

2013-09-19 Thread random832
On Wed, Sep 18, 2013, at 16:13, Dave Angel wrote: > So is the bug in Excel, in Windows, or in the Python library? Somebody > is falling down on the job; if Windows defines the string as ending at > the first null, then the Python interface should use that when defining > the text defined with CF_

Re: iterating over a file with two pointers

2013-09-19 Thread Oscar Benjamin
On 19 September 2013 15:38, Peter Otten <__pete...@web.de> wrote: >> While running the above python.exe was using 6MB of memory (according >> to Task Manager). I believe this is because tee() works as follows >> (which I made up but it's how I imagine it). > > [...] > >> However, when I ran the abo

A question about semantics from the standard library's documentation

2013-09-19 Thread Aseem Bansal
In Python 3.3.2 documentation on the Python Standard library's introduction these sentences are given "For these types, the Python language core defines the form of literals and places some constraints on their semantics, but does not fully define the semantics. (On the other hand, the language

Re: lxml question -- creating an etree.Element attribute with ':' in the name

2013-09-19 Thread Stefan Behnel
Burak Arslan, 18.09.2013 21:35: > On 09/18/13 21:59, Roy Smith wrote: >> I can create an Element with a 'foo' attribute by doing: >> >> etree.Element('my_node_name', foo="spam") >> >> But, how do I handle something like: >> >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";, since "xmlns:xsi

django admin.py error

2013-09-19 Thread Gary Roach
Installation of the django admin.py package worked fine. But. when I tried to add my database to the admin page I get the following error: ImportError at /admin/ cannot import name membership Request Method: GET Request URL:http://127.0.0.1:8000/admi

Re: django admin.py error

2013-09-19 Thread John Gordon
In Gary Roach writes: > Installation of the django admin.py package worked fine. But. when I > tried to add my database to the admin page I get the following error: > ImportError at /admin/ > cannot import name membership > ['/home/gary/ProgramFiles/mysite/mysite', > My a

Why does it have red squiggly lines under it if it works perfectly fine and no errors happen when I run it?

2013-09-19 Thread William Bryant
the word 'def' has squiggily lines but the program works fine. It says: Syntax Error: expected an indented block. - why? def restart(): print(""" Cacluation DONE! """) restart = input("\nEnter yes if you want to make a new list and no

Re: Why does it have red squiggly lines under it if it works perfectly fine and no errors happen when I run it?

2013-09-19 Thread patrick vrijlandt
John Gordon wrote: > In <22b99b0a-598f-4500-9de9-5041c2ce2...@googlegroups.com> William Bryant > writes: > >> the word 'def' has squiggily lines but the program works fine. It says: >> Syntax Error: expected an indented block. - why? > >> def restart(): > > This may be caused by the code befo

Re: Why does it have red squiggly lines under it if it works perfectly fine and no errors happen when I run it?

2013-09-19 Thread Ian Kelly
Syntactically, it looks fine. I would guess the problem is with whatever editor you are using. Or as John noted, it could be caused by the code above it. I do see an unrelated bug in there, though. You are using the name "restart" both for a string entered by the user and for the name of the fu

Re: django admin.py error (solved)

2013-09-19 Thread Gary Roach
On 09/19/2013 11:56 AM, John Gordon wrote: In Gary Roach writes: On 09/19/2013 11:15 AM, John Gordon wrote: Does /home/gary/ProgramFiles/mysite/mysite/models.py define an object named 'membership'? Yes. The following is the top part of the models.py file: q class Membership(models.Mod

Re: A question about semantics from the standard library's documentation

2013-09-19 Thread Chris Angelico
On Fri, Sep 20, 2013 at 1:28 AM, Aseem Bansal wrote: > In Python 3.3.2 documentation on the Python Standard library's introduction > these sentences are given > > "For these types, the Python language core defines the form of literals and > places some constraints on their semantics, but does no

Re: Stripping characters from windows clipboard with win32clipboard from excel

2013-09-19 Thread Neil Cerutti
On 2013-09-18, Dave Angel wrote: > On 18/9/2013 17:40, Neil Hodgson wrote: > >> Dave Angel: >> >>> So is the bug in Excel, in Windows, or in the Python library? Somebody >>> is falling down on the job; if Windows defines the string as ending at >>> the first null, then the Python interface shoul

Re: django admin.py error

2013-09-19 Thread Gary Roach
On 09/19/2013 11:15 AM, John Gordon wrote: In Gary Roach writes: Installation of the django admin.py package worked fine. But. when I tried to add my database to the admin page I get the following error: ImportError at /admin/ Does /home/gary/ProgramFiles/mysite/mysite/models.py

Re: Why does it have red squiggly lines under it if it works perfectly fine and no errors happen when I run it?

2013-09-19 Thread John Gordon
In <22b99b0a-598f-4500-9de9-5041c2ce2...@googlegroups.com> William Bryant writes: > the word 'def' has squiggily lines but the program works fine. It says: > Syntax Error: expected an indented block. - why? > def restart(): This may be caused by the code before 'def'. Post the whole program.

Re: A question about semantics from the standard library's documentation

2013-09-19 Thread Terry Reedy
On 9/19/2013 11:28 AM, Aseem Bansal wrote: In Python 3.3.2 documentation on the Python Standard library's introduction these sentences are given "For these types, the Python language core defines the form of literals and places some constraints on their semantics, but does not fully define the

Re: Why does it have red squiggly lines under it if it works perfectly fine and no errors happen when I run it?

2013-09-19 Thread Dave Angel
On 19/9/2013 14:46, William Bryant wrote: > the word 'def' has squiggily lines but the program works fine. It says: > Syntax Error: expected an indented block. - why? > The direct answer is that your terminal program must be broken. it should not use "squiggly lines" for any purposes. But per

Re: Is %z broken for return values of time.gmtime()?

2013-09-19 Thread Anssi Saari
random...@fastmail.us writes: > I would argue that it _should_ be, and that it should populate it with 0 > in gmtime or either with timezone/altzone or by some sort of reverse > calculation in localtime, but it is not. Another problem to add to my > list of reasons for my recent python-ideas propo

Using the MSI installer on Windows: Setting PATH and Setuptools

2013-09-19 Thread cython
Hello All, I really hate Windows, and I have only intermittent access to Windows machines right now. When I install Python 2.7 on Windows using the MSI installer, it definitely does not modify the PATH variable. So I modify the PATH variable myself as follows: setx PATH %PATH%;C:\Python27\ Q

Re: Bug tracker breaks when given a username with an uppercase letter

2013-09-19 Thread Terry Reedy
On 9/19/2013 12:33 PM, random...@fastmail.us wrote: Registration appears to succeed, but does not allow login, and I can't tell if email confirmation worked or not. I was able to register by changing it to lowercase, but I had to guess what was happening. Odd. There are existing usernames with

Re: Using the MSI installer on Windows: Setting PATH and Setuptools

2013-09-19 Thread cython
On Thursday, September 19, 2013 4:06:56 PM UTC-4, Skip Montanaro wrote: > > I am not a Windows person, but wouldn't pip do the trick? > PIP would definitely do the trick. Does the MSI include PIP? If it does not include PIP, then how can I easily install it from the command line? I am looking f

Re: Stripping characters from windows clipboard with win32clipboard from excel

2013-09-19 Thread Dave Angel
On 19/9/2013 11:53, Neil Cerutti wrote: > On 2013-09-18, Dave Angel wrote: >> On 18/9/2013 17:40, Neil Hodgson wrote: >> >>> Dave Angel: >>> So is the bug in Excel, in Windows, or in the Python library? Somebody is falling down on the job; if Windows defines the string as ending at >>

Re: Using the MSI installer on Windows: Setting PATH and Setuptools

2013-09-19 Thread Skip Montanaro
> PIP would definitely do the trick. Does the MSI include PIP? If it does not > include PIP, then how can I easily install it from the command line? I am > looking for something like this: Not yet, but I think just around the corner: http://www.python.org/dev/peps/pep-0453/ Unlike most enhance

Re: subprocess call is not waiting.

2013-09-19 Thread Terry Reedy
On 9/19/2013 7:42 AM, harish.barve...@gmail.com wrote: subprocess.call(tempFileName, shell=True).communicate() should raise an AttributeError as the int returned by subprocess.call does not have a .communicate method. this process is not blocking. Why do you think that? All function calls

Re: Using the MSI installer on Windows: Setting PATH and Setuptools

2013-09-19 Thread Skip Montanaro
> Question 4: If the Windows MSI installer indeed lacks Setuptools, what is the > best way to install it from the command line in a future-proof manner (on > Windows)? I am imagining something like this: > > wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py > python ez_setup.py

Re: django admin.py error

2013-09-19 Thread John Gordon
In Gary Roach writes: > On 09/19/2013 11:15 AM, John Gordon wrote: > > Does /home/gary/ProgramFiles/mysite/mysite/models.py define an object > > named 'membership'? > Yes. The following is the top part of the models.py file: q > class Membership(models.Model): > id_membership =

python 2.7 SSL to fetch servers notAfter date

2013-09-19 Thread Bryan Irvine
I'm trying to connect to an SSL application using client certs to grab the remote certs notAfter time. When I connect using 'openssl s_client' and pass my client cert/key I can see it in the cert chain, but when I attempt to use get_peer_certificate() in python (2.7) I only get a blank dict and

Bug tracker breaks when given a username with an uppercase letter

2013-09-19 Thread random832
Registration appears to succeed, but does not allow login, and I can't tell if email confirmation worked or not. I was able to register by changing it to lowercase, but I had to guess what was happening. -- https://mail.python.org/mailman/listinfo/python-list

RE: Using the MSI installer on Windows: Setting PATH and Setuptools

2013-09-19 Thread Prasad, Ramit
cyt...@m.allo.ws wrote: > Hello All, > > I really hate Windows, and I have only intermittent access to Windows > machines right now. > > When I install Python 2.7 on Windows using the MSI installer, it definitely > does not modify the PATH > variable. So I modify the PATH variable myself as fol

Re: Why does it have red squiggly lines under it if it works perfectly fine and no errors happen when I run it?

2013-09-19 Thread Ian Kelly
On Thu, Sep 19, 2013 at 1:22 PM, William Bryant wrote: > It was the other functions above it. Thanks. but I tried to do the while > loop - I don't think I did it right, I am novice in python and I am 13 years > old. It should be structured like this: while True: answer = input("Enter

Re: creating rectangle with qt-designer

2013-09-19 Thread Rhodri James
On Wed, 18 Sep 2013 04:41:13 +0100, Mohsen Pahlevanzadeh wrote: Question: How can i draw a same rectangle with qt-designer? First, posting an image to a newsgroup is pretty damn unfriendly. Please don't do it again. Second, wouldn't this question be better answered by the Qt Designer

Re: creating rectangle with qt-designer

2013-09-19 Thread Vincent Vande Vyvre
Le 18/09/2013 05:41, Mohsen Pahlevanzadeh a écrit : Dear all, I need to draw a rectangle , according to attached picture , you see a rectangle in a form that enclosed with a text: "Rebuild Last Target". Question: How can i draw a same rectangle with qt-designer? Yours, Mohsen See : http://p

Re: Tryign to send mail via a python script by using the local MTA

2013-09-19 Thread Jake Angulo
Up Robert Kern's reply! I was waiting for smtplib to be mentioned... finally! Instead people simply answer philosophically. I dont want to judge whether OP is a troll or not - but i found a lot of arrogant replies here. I have also worked on an antispa

Missing py2exe, needed 4 a gcode generator to engrave text in fancy ttf fonts in steel

2013-09-19 Thread Gene Heskett
Greetings; Since the missing module is intended for making python stuff run standalone on a winderz box, I've no clue why it should be needed to build and make F- Engrave run on my 10.04.4 LTS box, but it insists on loading it in the setup.py script that starts it the first time. FWIW, cxfreeze

Re: Tryign to send mail via a python script by using the local MTA

2013-09-19 Thread Antoon Pardon
Op 20-09-13 05:56, Jake Angulo schreef: > Up Robert Kern's reply! > > I was waiting for smtplib to > be mentioned... finally! Instead people simply answer philosophically. > I dont want to judge whether OP is a troll or not - but i found a lot > of arro

Can i run my python program under andriod?

2013-09-19 Thread Mohsen Pahlevanzadeh
Dear all, I need to binary with distutils, and run it under android OS, Do you have any experience? yours, Mohsen -- https://mail.python.org/mailman/listinfo/python-list