Re: Python horks on WinXP path names

2011-12-08 Thread Jerry Hill
On Thu, Dec 8, 2011 at 3:16 PM, Eric wrote: > I'm running Python 2.7 on WinXP (ActiveState community version) and > when I try to do this: > > if __name__ == '__main__': >root = Tkinter.Tk() >root.withdraw() >fileNames = tkFileDialog.askopenfilenames() >root.destroy() >print f

Re: tracking variable value changes

2011-12-08 Thread Jerry Hill
On Thu, Dec 8, 2011 at 3:17 PM, Catherine Moroney < catherine.m.moro...@jpl.nasa.gov> wrote: > Is there some way to rewrite the code above so the change of "a" from > 1.0 to 100.0 is reflected in the dictionary. I would like to use > simple datatypes such as floats, rather than numpy arrays or cl

Re: Upgraded Ubuntu -> 11.10, Python -> 2.7.2. Now psyco doesn't work?

2011-12-20 Thread Jerry Hill
On Tue, Dec 20, 2011 at 5:43 PM, John Ladasky wrote: > I was running Ubuntu Linux 10.10, on which Python 2.6.6 was the > standard distribution.  I succeeded in doing an "alternate install" of > Python 2.7.2, over Ubuntu 10.10.  But I use so many packages in my > code.  Dealing with the package dep

Re: Type object returned by the re.compile function

2011-12-27 Thread Jerry Hill
On Tue, Dec 27, 2011 at 4:56 PM, candide wrote: import re reo = re.compile('') reo.__class__ > Traceback (most recent call last): >  File "", line 1, in > AttributeError: __class__ I'm not going to comment on what type is returned from the various functions in the re module,

Re: Please don't use "setuptools", the "rotten .egg" install system.

2012-01-18 Thread Jerry Hill
On Wed, Jan 18, 2012 at 1:24 PM, John Nagle wrote: > Please don't use "setuptools", the so-called "easy" > installation system in your packages. It just makes things > more complicated, adds dependencies, and needs too many weird > options if things aren't exactly where it wants them. Since >

Re: import in Python3.3

2013-03-26 Thread Jerry Hill
On Mon, Mar 25, 2013 at 11:49 PM, rocky wrote: >> On Sun, 24 Mar 2013 18:12:49 -0500, Fabian von Romberg wrote: >> > I have a package name collections and inside of my package I want to > I find this kind of thing sad: it feels to me that programmers are working > around somewhat arbitrary and c

Re: newbee I have an object how to check what's his class?

2006-11-10 Thread Jerry Hill
On 11/10/06, consternation <[EMAIL PROTECTED]> wrote: result:isinstance(x,X)Falsetype(x) is XFalselistI think you need to show us more of your code.  Your variable, v, is not of type X in this example.  Instead, it is of type list.  What is self.mem.items()?  It isn't a dictionary like your commen

Searching for patterns on the screen

2006-09-15 Thread Jerry Hill
Hello all, I have a piece of code I could use some help optimizing. What I'm attempting to do is periodically grab a screenshot, and search for 2D patterns of black pixels in it. I don't care about any color other than black. Here's some simple code that simulates my worst-case scenario, scanni

Re: Searching for patterns on the screen

2006-09-15 Thread Jerry Hill
On 15 Sep 2006 08:16:41 -0700, John Machin <[EMAIL PROTECTED]> wrote: > C:\junk>python -mtimeit -s"BLACK=(0,0,0);rgb=(1,1,1)" "rgb==BLACK" > 100 loops, best of 3: 0.129 usec per loop > > C:\junk>python -mtimeit -s"rgb=(1,1,1)" "rgb==(0,0,0)" > 100 loops, best of 3: 0.127 usec per loop Surp

Re: The Python Papers Edition One

2006-11-24 Thread Jerry Hill
On 11/25/06, Jerry Hill <[EMAIL PROTECTED]> wrote: > On 23 Nov 2006 15:09:11 -0800, [EMAIL PROTECTED] > <[EMAIL PROTECTED]> wrote: > > Yes, it's true that you can't resell copies of The Python Papers for > > personal profits, but you may derive from it, repr

Re: The Python Papers Edition One

2006-11-25 Thread Jerry Hill
On 11/25/06, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > And how do you think this is different from any other publication? That > Python Papers is under a CC licence is a red-herring. Well, the CC license is viral. According to the CC explanation of the Attribution-NonCommercial-ShareAlike lice

Re: ERROR CLOSING CONNECTION: mysql connection close

2006-12-08 Thread Jerry Hill
On 8 Dec 2006 13:33:05 -0800, johnny <[EMAIL PROTECTED]> wrote: > I am getting following connection error from my python script: > > conn.close() > AttributeError: adodb_mysql instance has no attribute 'close' >From the sample code on the adodb documentation page, that should be spelled "conn.

Re: formattazione cifra con decimali

2007-01-09 Thread Jerry Hill
On 9 Jan 2007 01:43:41 -0800, Nuke <[EMAIL PROTECTED]> wrote: > I need to visualize a number (or a string of that number) using the > decimal separator. > i have this number visualized: 50320,12 and i need that the > visualization of this number is: 50.320,13. > There is a function that directly co

Re: c[:]()

2007-05-31 Thread Jerry Hill
On 5/31/07, Warren Stringer <[EMAIL PROTECTED]> wrote: > In summation: > I started this thread asking why c[:]() wouldn't work Because it's not part of the language. Did you read something that made you think it would work? Or are you proposing a change to the language? I think you're

Re: c[:]()

2007-06-01 Thread Jerry Hill
On 6/1/07, Warren Stringer <[EMAIL PROTECTED]> wrote: > > And that your > > insisting on ``c[:]()`` instead of just ``c()`` seems to indicate you want > > a change that is quite surprising. It would mean that a slice of a list > > returns an other type with the __call__ method implemented. > > I a

Re: Binary

2007-06-08 Thread Jerry Hill
On 6/8/07, Brain Murphy <[EMAIL PROTECTED]> wrote: > I need it to show the remainder. like remainder 1 or 0 the put all of them > in a list that is backwards. Take a look at the divmod() function. It take the numerator and denominator and returns a tuple of the quotient and remainder. For exampl

Re: Binary

2007-06-08 Thread Jerry Hill
Brian, I'm including the list back in on this reply, so that more than just me can see your message and potentially help out. On 6/8/07, Brain Murphy <[EMAIL PROTECTED]> wrote: > > this is what i have so far. > x= 100 > b=2 > while x > 0: > print x > x=divmod(x,b) > > the problem is that s

Re: Splitting SAX results

2007-06-08 Thread Jerry Hill
On 6/8/07, IamIan <[EMAIL PROTECTED]> wrote: > Well SAX isn't the problem... maybe I should repost this with a > different title. The SAX part works just as I want, but the results I > get back need to be manipulated. No matter what I try I can't split a > result like 'Title 1:Description' on the c

Re: Re printing on same line.

2007-06-15 Thread Jerry Hill
On 6/15/07, HMS Surprise <[EMAIL PROTECTED]> wrote: > I want to print a count down timer on the same line. I tried > > print '\r', timeLeft, > > which just appends to the same line. Sounds to me like whatever you're printing to doesn't do what you expect when it encounters a carriage return (\

Re: finding an element in a string

2007-06-25 Thread Jerry Hill
On 6/25/07, Miguel Oliveira <[EMAIL PROTECTED]> wrote: > I was looking for a way for the program to respond "good" to any sentence > that would contain the word "fine" in it. This will work for any string with the string "fine" in it. if "fine" in x: print "Good." -- Jerry -- http://mail.p

Re: subprocess.Popen() problem

2007-06-26 Thread Jerry Hill
On 6/26/07, 7stud <[EMAIL PROTECTED]> wrote: > p.stdin.write("hello") You need to add the linefeed, otherwise your mytest.py process is still waiting for you to finish typing. So, use this instead: p.stdin.write("hello\n") -- Jerry -- http://mail.python.org/mailman/listinfo/python-list

Re: Zip File Woes

2007-06-27 Thread Jerry Hill
On 6/27/07, Robert Rawlins - Think Blue <[EMAIL PROTECTED]> wrote: > zip = zipfile.ZipFile('Media/Media.zip', 'r') Shouldn't you open this file in binary mode? It shouldn't make any difference on unix machines, but will possibly break under windows. That may also explain why it work

Re: How can i change an Object type ?

2007-07-03 Thread Jerry Hill
On 7/3/07, KuhlmannSascha <[EMAIL PROTECTED]> wrote: > I am focussing on the Playlists of the object UserPlaylist. > (CodeLine: if curPlaylist.Kind == 2:) > After that i should be sure to have a UserPlaylist, but Python stops > with an exception that the requested Attribute "Smart" is not > avai

Re: using subprocess for non-terminating command

2007-07-04 Thread Jerry Hill
On 7/4/07, O.R.Senthil Kumaran <[EMAIL PROTECTED]> wrote: > Yes, I am aware of the ping -c option. But again even that does not help. > try > process = subprocess.Popen('ping -c 10 127.0.0.1', stdin=subprocess.PIPE, > shell=True) > process.stdout.read() # This will hang again. When I try that, it

Re: using subprocess for non-terminating command

2007-07-04 Thread Jerry Hill
On 7/4/07, O.R.Senthil Kumaran <[EMAIL PROTECTED]> wrote: > Only when the program has executed and the output available, subprocess can > read through PIPE's stdout it seems ( not at any other time). > With killing, I loose the output. I think you have to read the data from the process's stdout be

Re: I need a string/list/generator/comprehension incantation.

2007-04-20 Thread Jerry Hill
On 4/20/07, Steven W. Orr <[EMAIL PROTECTED]> wrote: > I really tried. I give up. > > Now I want something that's going to give me a string whose value is the > set of all of the first letters of months. Order is not important. >>> ''.join(set([s[0] for s in calendar.month_abbr[1:]])) 'ADFJMONS'

Re: Simple sqlite3 question

2007-04-24 Thread Jerry Hill
On 24 Apr 2007 10:03:45 -0700, cjl <[EMAIL PROTECTED]> wrote: > When I run the script and there is no file named optiondata, one is > created and the correct data is added to it. If I run the script > again then the data from the first run seems to be replaced with the > data from the second run.

Re: ascii to unicode line endings

2007-05-03 Thread Jerry Hill
On 2 May 2007 09:19:25 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > The code: > > import codecs > > udlASCII = file("c:\\temp\\CSVDB.udl",'r') > udlUNI = codecs.open("c:\\temp\\CSVDB2.udl",'w',"utf_16") > udlUNI.write(udlASCII.read()) > udlUNI.close() > udlASCII.close() > > This doesn't se

Re: newbie: copy base class fields

2007-05-03 Thread Jerry Hill
On 3 May 2007 07:14:04 -0700, tmp123 <[EMAIL PROTECTED]> wrote: > Of course, it is not an option to copy one by one all the fields of > class A inside the __init__ of B. Is it okay to copy them all at once? Like this: class B(A): def __init__(self, a): self.__dict__.update(a.__dict__

Re: is for reliable?

2007-05-07 Thread Jerry Hill
On 5/7/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > for fn in cachefilesSet: ... > this code stops at the 473th file instead of reaching 1398 This is often caused by mutating the object you are iterating over inside the for loop. I didn't see anything in the code you posted that would do th

Re: module error for elementtree

2007-05-11 Thread Jerry Hill
On 11 May 2007 00:05:19 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > For the above code to work elementtree is > imported in first line ,but when running it says : > ImportError: No module named elementtree.ElementTree > Does thie module exists as default or a patch is

Re: Inheriting from Python list object(type?)

2007-05-23 Thread Jerry Hill
On 23 May 2007 09:58:36 -0700, Mangabasi <[EMAIL PROTECTED]> wrote: > There must be a way to inherit from the list type without having to > redefine all the methods and attributes that regular lists have. Like this: class Point(list): def __init__(self, x, y, z = 1): list.__init__(sel

Re: Inheriting from Python list object(type?)

2007-05-23 Thread Jerry Hill
On 23 May 2007 11:31:56 -0700, Mangabasi <[EMAIL PROTECTED]> wrote: > When I modified this to: > > class Point(list): > def __init__(self,x,y): > super(Point, self).__init__([x, y]) > self.x = x > self.y = y > > It worked. Are you sure? >>> p = Point(10, 20) >>> p [10,

Re: Parsing Rdf (Rewrite)

2007-05-31 Thread Jerry Hill
On 5/31/07, Brandon McGinty <[EMAIL PROTECTED]> wrote: > I would think that I could do: > etexts=tree.findall('pgterms:etext') > (or something like that), Which would pull out each etext record in the > file. > I could then do: > for book in etexts: > print book.get('id') > This isn't yielding any

Re: Where is the collections module?

2007-07-22 Thread Jerry Hill
On 7/22/07, Gordon Airporte <[EMAIL PROTECTED]> wrote: > Gordon Airporte wrote: > > I was going to try tweaking defaultdict, but I can't for the life of me > > find where the collections module or its structures are defined. Python > > 2.5. > > Thanks all. I was expecting it in Python. Time to dust

Re: split a string of space separated substrings - elegant solution?

2007-07-31 Thread Jerry Hill
On 7/31/07, Helmut Jarausch <[EMAIL PROTECTED]> wrote: > I'm looking for an elegant solution to the following (quite common) > problem: > > Given a string of substrings separated by white space, > split this into tuple/list of elements. > The problem are quoted substrings like > > abc "xy z" "1 2

Re: Iteration over strings

2007-07-31 Thread Jerry Hill
On 7/31/07, Jay Loden <[EMAIL PROTECTED]> wrote: > This isn't just a problem with the socket module, so please don't think I'm > picking on it or singling it out, it's something I've seen a number of > places. e.g. from os.stat: You picked out two specific examples as being bad, so I thought I'd

Re: os.listdir path error

2007-08-03 Thread Jerry Hill
On 8/3/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hello > > Here is my simple listdir example: > > >>> import os > >>> os.listdir("C:\Python24\") # This directory relly exists > > Here is my error: > > WindowsError: [Errno 3] The system cannot find the path specified: 'l/ > *.*' That's a

Re: parsing a dbIII file

2007-08-07 Thread Jerry Hill
On 8/7/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I have to parse a file (that is a dbIII file) whose stucture look like > this: > |string|, |string|, |string that may contain commas inside|, 1, 2, 3, | > other string| The CSV module is probably the easiest way to go: >>> data = "|string|

Re: SQLite3 trapping OperationalError

2007-03-09 Thread Jerry Hill
On 3/9/07, jim-on-linux <[EMAIL PROTECTED]> wrote: > However python 2.5, > except OperationalError: > responds with > "OperationalError" is not defined. I believe that needs to be spelled except sqlite3.OperationalError: do_something() -- Jerry -- http://mail.python.org/mailman/listinfo/pyt

Re: Pickle Problem

2007-03-15 Thread Jerry Hill
On 15 Mar 2007 08:13:53 -0700, tonyr1988 <[EMAIL PROTECTED]> wrote: > if __name__=='__main__': > x = DemoClass > x.WriteToFile Here, you're binding the Class DemoClass to the name x. What you probably meant to do is create a new instance of DemoClass, and bind that to name x, like

Re: How to get the previous line in a file?

2007-03-16 Thread Jerry Hill
On 3/16/07, Qilong Ren <[EMAIL PROTECTED]> wrote: > I have a question. I need to do some text processing. I need to read from a > file line by line. If some line is met with some condition, the previous > line needs some modification. How to get the info of the previous line? I would do something

Re: SQLite3, data not found

2007-03-16 Thread Jerry Hill
On 3/16/07, jim-on-linux <[EMAIL PROTECTED]> wrote: > Below, the first select produces results but, > after closing then re-opening the database the > select produces an empty list. Anyone know the > reason ?? When you first open a connection, you implicitly begin a transaction. You need to call

Re: Writing files

2007-03-19 Thread Jerry Hill
On 3/19/07, Adonis Vargas <[EMAIL PROTECTED]> wrote: > Actually, I re-ran this in a terminal and it worked perfectly. I was > using IDLE to write this code, kinda peculiar. Maybe something to do > with IDLE and CSV (or writing to files) with lines > ~1000. A socket > timing out maybe? It's because

Re: Problem with filter()

2007-04-03 Thread Jerry Hill
On 4/3/07, Boudreau, Emile <[EMAIL PROTECTED]> wrote: > Sorry folks my mistake def is_dev should be: > def is_Dev(stringy): > stringx = stringy.split('-') > if stringx[0] == '': > if stringx[1] == r'win32': > if stringx[2] == r'app': > if stringx[4] == r'dev.tar.gz': >

Re: try... except SyntaxError: unexpected EOF while parsing

2007-04-04 Thread Jerry Hill
On 4 Apr 2007 10:38:24 -0700, oscartheduck <[EMAIL PROTECTED]> wrote: > I have a small script for doing some ssh stuff for me. I could have > written it as shell script, but wanted to improve my python skills > some. > > RIght now, I'm not catching a syntax error as I'd like to. ... > port = input(

Re: pop() clarification

2007-04-11 Thread Jerry Hill
On 4/11/07, Scott <[EMAIL PROTECTED]> wrote: > I see says, "When removing a specific element from a list using pop() it > must be in this format: list.pop([i]). The tutorial (http://docs.python.org/tut/node7.html) says the following: pop( [i] ) Remove the item at the given position in the lis

Re: RegEx question

2007-10-04 Thread Jerry Hill
> As far as the dialect, I can't be sure. I am unable to find documentation > for Comment Reflower and thus cannot figure out what type of regex it is > using. What exactly do you mean by your question, "are you using raw > strings?". Thanks for your response and I apologize for the lack of detail.

Re: pytz has so many timezones!

2007-10-11 Thread Jerry Hill
On 10/10/07, Sanjay <[EMAIL PROTECTED]> wrote: > Thanks a lot, Guys. The immediate step I think to take is having two > combo boxes (dividing the data by '/'). Thanks for enormous response > and the valuable suggestions! The most elegant way I've seen to handle this in a graphical interface (eithe

Re: os.mkfifo

2007-01-11 Thread Jerry Hill
On 1/11/07, Gigs_ <[EMAIL PROTECTED]> wrote: > is os.mkfifo available on windows xp http://docs.python.org/lib/os-file-dir.html#l2h-2683 -- Jerry -- http://mail.python.org/mailman/listinfo/python-list

Re: OT Annoying Habits (Was: when format strings attack)

2007-01-19 Thread Jerry Hill
On 1/19/07, Carroll, Barry <[EMAIL PROTECTED]> wrote: > Secondly, can someone point me to the Standard Usenet Convention that > mandates against top-posting. This is not sarcasm; I would really like > to see it. For what (very little) it's worth, see RFC 1855. -- Jerry -- http://mail.python.or

Re: Array delete

2007-02-07 Thread Jerry Hill
On 1/28/07, Scripter47 <[EMAIL PROTECTED]> wrote: > Can someone plz make a function for that takes a array, and then search > in it for duplicates, if it finds 2 or more items thats the same string > then delete all except 1. >>> myList = [1, 1, 2, 4, 8, 8, 8, 8, 8, 8, 10] >>> myList = list(set(

Re: Python new user question - file writeline error

2007-02-07 Thread Jerry Hill
On 7 Feb 2007 11:31:32 -0800, James <[EMAIL PROTECTED]> wrote: > I have this code: ... > infile.close > outfile.close ... > 1. the outfile doesn't complete with no error message. when I check > the last line in the python interpreter, it has read and processed the > last line, but the output file

Re: Having multiple instances of a single application start a single instance of another one

2007-02-23 Thread Jerry Hill
On 2/23/07, buffinator <[EMAIL PROTECTED]> wrote: > 2. How do I check if a process ID is bound to a running application. Under windows, this should work: >>> import win32process >>> running_pids = win32process.EnumProcesses() >>> running_pids (0, 4, 1048, 1496, 1656, 1836, 1896, 756, 988, 1712, 22

Re: finding out the precision of floats

2007-02-25 Thread Jerry Hill
On 25 Feb 2007 06:11:02 -0800, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > Moreover the reason I got interested in this is because I am creating > a Dec class (decimal numbers) Are you familiar with Python's Decimal library? http://docs.python.org/lib/module-decimal.html -- Jerry -- http://ma

Re: How to check for remaining hard drive space in Windows?

2007-02-28 Thread Jerry Hill
On 2/28/07, Tim Golden <[EMAIL PROTECTED]> wrote: > Well it's not often someone beats me to a WMI > solution :) Just to be different, you can also > look at the GetDiskFreeSpace function in the > win32api module of the pywin32 extensions. The MSDN page for that function warns: "The GetDiskFreeSpac

Re: Python Tutorial

2007-03-01 Thread Jerry Hill
On 3/1/07, Timm Florian Gloger <[EMAIL PROTECTED]> wrote: > is Guido van Rossum's "Python Tutorial" in non-HTML formats (e.g. PDF > or PS) avaiable for free? Yes. Download one of the PDF documentation zips from here: http://docs.python.org/download and extract the tut.pdf file. AFAIK it's not av

Re: python equivalent of bash find

2007-03-01 Thread Jerry Hill
On 1 Mar 2007 12:14:43 -0800, BartlebyScrivener <[EMAIL PROTECTED]> wrote: > I recently moved from XP to Linux, but would like to use Python > whenever possible. > > line from bash script: > > find ~/Mail -xdev -type f \( -mtime 0 -or -mtime 1 \) -exec cp -aPvu > "{}" /backup-dest \; > > What modul

Re: WindowsError: [Error 5] Access is denied With _winreg.enum

2007-11-28 Thread Jerry Hill
On Nov 28, 2007 11:04 AM, black_13 <[EMAIL PROTECTED]> wrote: > I have included a small script the reproduces the error I am having in > larger script. The line 'hkey = > _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,name)' > seems to be causing the error but im not sure why. ... > WindowsError: [Er

Re: Escaping the semicolon?

2007-12-04 Thread Jerry Hill
On Dec 4, 2007 11:33 AM, Nick <[EMAIL PROTECTED]> wrote: > Try "123 *?/ abc d;o /$'" as the argument... and you get - > > 123 \*\?\/ abc d\\;o \/\$ That's because of the order you're doing the replacement. Put a print statement inside your for loop and you'll see something like this: input start

Re: Problem in the program flow...please help?

2008-01-09 Thread Jerry Hill
On Jan 9, 2008 7:44 AM, jatin patni <[EMAIL PROTECTED]> wrote: > I have a button(GUI) which when clicked, calls a function connect( ) which > takes around 5-20 seconds to complete(As I mentioned Earlier) > The problem is, during this time the other part of the code is rendered > useless, I cannot a

Re: What is a shortcut to the Default home directory in Windows

2008-01-18 Thread Jerry Hill
On Jan 18, 2008 3:19 PM, Daniel Folkes <[EMAIL PROTECTED]> wrote: > I am trying to write a file to the users file system. > > I need it to be in there home directory in WINDOWS. I know there is a > "shortcut" to home in Linux("~"), but is there an equivalent to that > in windows. Or to get to the

Re: printing escape character

2008-01-22 Thread Jerry Hill
On Jan 22, 2008 1:38 PM, hrochonwo <[EMAIL PROTECTED]> wrote: > Hi, > > I want to print string without "decoding" escaped characters to > newline etc. > like print "a\nb" -> a\nb > is there a simple way to do it in python or should i somehow use > string.replace(..) function ? >>> print 'a\nb'.enc

Re: HTML parsing confusion

2008-01-23 Thread Jerry Hill
On Jan 23, 2008 7:40 AM, Alnilam <[EMAIL PROTECTED]> wrote: > Skipping past html validation, and html to xhtml 'cleaning', and > instead starting with the assumption that I have files that are valid > XHTML, can anyone give me a good example of how I would use _ htmllib, > HTMLParser, or ElementTre

Re: socket script from perl -> python

2008-02-07 Thread Jerry Hill
On Feb 7, 2008 9:39 AM, kettle <[EMAIL PROTECTED]> wrote: > f = open('/home/myuname/socket.wav','rb') > audio = "" > for line in f: > audio += line I don't know anything about socket programming in python, but this bit doesn't seem right for working on a binary file. You should just read all

Re: Odd behaviour with list comprehension

2008-02-29 Thread Jerry Hill
On Fri, Feb 29, 2008 at 10:01 PM, Ken Pu <[EMAIL PROTECTED]> wrote: > Is there a way for me keep the iterating variable in list > comprehension local to the list comprehension? Kind of. You can use a generator expression instead of a list comprehension, and those don't leak their internal varia

Re: I cannot evaluate this statement...

2008-03-07 Thread Jerry Hill
On Fri, Mar 7, 2008 at 3:38 PM, waltbrad <[EMAIL PROTECTED]> wrote: > Now. Run this on linux. The first condition evaluates sys.platform[:3] > == 'win' as false. So, the next comparison should be 'False' or > 'python' -- This is because 'and' returns the first false value. > But, again, on l

Re: cx_Oracle execute procedure

2008-03-19 Thread Jerry Hill
On Wed, Mar 19, 2008 at 11:03 AM, Poppy <[EMAIL PROTECTED]> wrote: > I've been working on the code below and and executes silently, no > complaints, however the end result should be a record in my table and it's > not added. The procedure works with the passed credentials using SQLPlus or > SQL

Re: dividing tuple elements with an int or float

2008-03-20 Thread Jerry Hill
On Thu, Mar 20, 2008 at 3:42 AM, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Wed, 19 Mar 2008 23:06:44 -0700, royG wrote: > > > > suppose > > origsz=(400,300) > > i want to divide the origsize by 2.5 so i can resize to (160,120) > > > > scale=2.5 > > how can i get the newsz? > > obviousl

Re: Filtering a Python list to uniques

2008-03-26 Thread Jerry Hill
On Wed, Mar 26, 2008 at 2:50 PM, kellygreer1 <[EMAIL PROTECTED]> wrote: > How come the Set() thing seems to work for some people and I get the > 'unhashable' error? > > How do you test for 'membership' on a dictionary? > > # where tmp is the non-unique list > # dct is a dictionary where each u

Re: Is subprocess.Popen completely broken?

2008-03-27 Thread Jerry Hill
On Thu, Mar 27, 2008 at 10:53 AM, Skip Montanaro <[EMAIL PROTECTED]> wrote: > I am trying to replace os.system calls with subprocess.Popen. This simple > example fails miserably: > > >>> proc = subprocess.Popen ("ls /tmp") > Traceback (most recent call last): > File "", line 1, in > File "

Re: Is subprocess.Popen completely broken?

2008-03-27 Thread Jerry Hill
> Why should I need to set shell=True? I'm not globbing anything. The > second case still fails: RTFM -- http://mail.python.org/mailman/listinfo/python-list

Re: Weird behaviour re: Python on Windows

2009-01-13 Thread Jerry Hill
On Tue, Jan 13, 2009 at 5:29 PM, Kevin Jing Qiu wrote: > I've been experiencing weird behavior of Python's os module on Windows: > > Here's the environment: > Box1: Running Windows 2003 Server with Apache+mod_python > Box2: Running Windows 2003 Server with Zope/Plone and Z:\ mapped to D:\ > on Box

Re: Unicode regex and Hindi language

2008-11-28 Thread Jerry Hill
On Fri, Nov 28, 2008 at 10:47 AM, Shiao <[EMAIL PROTECTED]> wrote: > The regex below identifies words in all languages I tested, but not in > Hindi: > > # -*- coding: utf-8 -*- > > import re > pat = re.compile('^(\w+)$', re.U) > langs = ('English', '中文', 'हिन्दी') I think the problem is that the H

Re: Checking a string against multiple matches

2008-12-01 Thread Jerry Hill
On Mon, Dec 1, 2008 at 2:31 PM, Aaron Scott <[EMAIL PROTECTED]> wrote: > Pseudocode: > > if "two" in ["one", "two", "three", "four"]: > return True That works, just like you wrote it: >>> "two" in ["one", "two", "three", "four"] True >>> "two" in ["one", "twofer", "three", "four"] False If

Re: Checking a string against multiple matches

2008-12-01 Thread Jerry Hill
On Mon, Dec 1, 2008 at 3:29 PM, Aaron Scott <[EMAIL PROTECTED]> wrote: > Damn you, Python, and your loose documentation! It never occurred to > me to actually TRY my pseudocode, since I couldn't find anything on > that type of statement. Anyway, feel free to ignore me from now on. I'm not sure whe

Re: help me~!about base64

2008-12-02 Thread Jerry Hill
2008/12/2 <[EMAIL PROTECTED]>: > it's run ,Eric gave me error,the error is "'module' object has no > attribute 'decodestring'", Do you have your own base64.py (or base64.pyc) that's shadowing the standard module base64? Try this: >>> import base64 >>> print base64.__file__ C:\Python25\lib\base6

Re: help me~!about base64

2008-12-02 Thread Jerry Hill
On Tue, Dec 2, 2008 at 2:08 PM, <[EMAIL PROTECTED]> wrote: print base64.__file__ > /usr/lib/python2.5/base64.pyc That looks fine, and matches what I have on my linux box. Your code works fine for me when I run it, so I'm out of ideas. -- Jerry -- http://mail.python.org/mailman/listinfo/pyt

Re: Python 3 read() function

2008-12-04 Thread Jerry Hill
On Thu, Dec 4, 2008 at 11:48 AM, Christian Heimes <[EMAIL PROTECTED]> wrote: > Cro wrote: >> vContent = io.StringIO() >> vContent = huge.read() # This line takes hours to process !!! > > Do you really mean io.StringIO? I guess you want io.BytesIO() .. I don't think it matters. Here's a quick comp

Re: Equivalent of 'wget' for python?

2008-12-08 Thread Jerry Hill
On Mon, Dec 8, 2008 at 11:53 AM, r0g <[EMAIL PROTECTED]> wrote: > urllib.urlretrieve(url_of_zip_file, destination_on_local_filesystem). In python 3.0, that appears to be: import urllib.request urllib.request.urlretrieve(url, local_file_name) -- Jerry -- http://mail.python.org/mailman/listinfo/p

Re: string split

2009-01-09 Thread Jerry Hill
On Fri, Jan 9, 2009 at 3:39 PM, Benjamin Kaplan > This looks like a CSV file to me. If that is the case, it is easier to use > the built-in csv module than to try to write your own parser. It should be as easy as this: import csv testfile = open('testfile.csv', 'w') testdata = """100-01001-001,"

Re: Class properties and object properties

2008-10-06 Thread Jerry Hill
On Mon, Oct 6, 2008 at 9:38 AM, SuperZE <[EMAIL PROTECTED]> wrote: > Interesting, but that does not explain the difference in the behavior > of myList and myInt > > Both were class-level variables, as far as I can see, and therefor a > and b should also share it They did share it, until you assign

Re: do something in time interval

2008-10-06 Thread Jerry Hill
On Mon, Oct 6, 2008 at 2:07 PM, Petr Jakes <[EMAIL PROTECTED]> wrote: > I have infinitive loop running script and I would like to check > something periodically after 5 seconds (minutes, hours...) time period > (I do not mean time.sleep(5) ). Till now, I have following script, but > I think there m

Re: print command don't work (subscripted) word[2:4]

2008-10-07 Thread Jerry Hill
On Tue, Oct 7, 2008 at 2:50 PM, <[EMAIL PROTECTED]> wrote: > Why is this not working ? > > bla = 'hondenriem' > print bla[0:4] # correct ! (= hond) > print bla[3:2] # nothing ! (= en) Why do you think the right answer is 'en'? bla[3:2] is asking for the slice starting at position 3, ending bef

Re: NameError question - def(self, master) - master not in namespace within class?

2008-10-09 Thread Jerry Hill
On Thu, Oct 9, 2008 at 11:43 AM, harijay <[EMAIL PROTECTED]> wrote: > Hi I am new to writing module and object oriented python code. I am > trying to understand namespaces and classes in python. > > I have the following test case given in three files runner , master > and child. I am getting an err

Re: Python 2.6, GUI not working on vista?

2008-10-09 Thread Jerry Hill
On Thu, Oct 9, 2008 at 3:48 PM, Mensanator <[EMAIL PROTECTED]> wrote: > Fine. Can you then see to it that this is mentioned on the Python > download page? I'm not sure if anyone has mentioned it in all of the invective, but the right thing to do is to report a bug on http://bugs.python.org. If the

Re: Python HTML parser chokes on UTF-8 input

2008-10-09 Thread Jerry Hill
On Thu, Oct 9, 2008 at 4:54 PM, Johannes Bauer <[EMAIL PROTECTED]> wrote: > Hello group, > > Now when I take "website" directly from the parser, everything is fine. > However I want to do some modifications before I parse it, namely UTF-8 > modifications in the style: > > website = website.replace(

Re: Unicode (UTF8) in dbhas on 2.5

2008-10-21 Thread Jerry Hill
On Tue, Oct 21, 2008 at 10:16 AM, Yves Dorfsman <[EMAIL PROTECTED]> wrote: > My terminal is setup in UTF-8, and... It did print correctly. I expected > that by setting coding: utf-8, all the I/O functions would do the encoding > for me, because if they don't then I, and everybody who writes a scrip

Re: portable python

2008-10-24 Thread Jerry Hill
On Fri, Oct 24, 2008 at 1:42 PM, asit <[EMAIL PROTECTED]> wrote: > I code in both windows and Linux. As python is portable, the o/p > should be same in both cases. But why the following code is perfect in > windows but error one in Linux ??? What error message do you get in linux? How are you r

Re: portable python

2008-10-24 Thread Jerry Hill
On Fri, Oct 24, 2008 at 2:33 PM, asit <[EMAIL PROTECTED]> wrote: > this the o/p > [EMAIL PROTECTED]:~/hack$ python portscan.py 59.93.128.10 10 20 > Traceback (most recent call last): > File "portscan.py", line 33, in >print str(port) + " : " + scan(ip,port,timeout) > File "portscan.py", line

Re: Python/Numeric users be aware!

2008-10-29 Thread Jerry Hill
On Wed, Oct 29, 2008 at 1:53 PM, Benyang <[EMAIL PROTECTED]> wrote: > The Python version is 2.5.1, and Numeric is the latest version 24.2. While 24.2 is the latest version of Numeric, it's also three years old and no longer supported. From http://numpy.scipy.org/ - "Numeric was the first arrayobj

Re: Problem using urllib to download images

2008-11-03 Thread Jerry Hill
On Mon, Nov 3, 2008 at 2:21 PM, <[EMAIL PROTECTED]> wrote: > Then perhaps it's a problem with my os. > [TERMINAL SESSION] > [18:16:33 Mon Nov 03] python > Python 2.6 (trunk:66714:66715M, Oct 1 2008, 18:36:04) > [GCC 4.0.1 (Apple Computer, Inc. build 5370)] on darwin > Type "help", "copyright", "c

Re: Sync paramstyle between sqlite and mysql

2008-11-11 Thread Jerry Hill
On Mon, Nov 10, 2008 at 1:00 PM, Daniel <[EMAIL PROTECTED]> wrote: > I have read in PEP249 (http://www.python.org/dev/peps/pep-0249/) that > there are five paramstyles, though it wasn't clear if I should expect > these to be implemented in all DBAPI2 compliant modules. I have found > that I can se

Re: object creation

2008-11-14 Thread Jerry Hill
On Fri, Nov 14, 2008 at 6:10 PM, BiraRai <[EMAIL PROTECTED]> wrote: > class box: > a = int() > b = int() > > def createSomething(self,x): At a guess, x = box() does create a new instance of your box class, but since you've declared a and b to be class variables instead of instance variables,

Re: object creation

2008-11-14 Thread Jerry Hill
On Fri, Nov 14, 2008 at 6:38 PM, Joe Strout <[EMAIL PROTECTED]> wrote: > On Nov 14, 2008, at 4:33 PM, Jerry Hill wrote: > >> Then add >> def __init__(self): >> a = 0 >> b = 0 > > Doesn't that have to be "self.a" and "self.b"?

Re: regular expressions ... slow

2008-11-17 Thread Jerry Hill
On Mon, Nov 17, 2008 at 4:37 PM, Uwe Schmitt <[EMAIL PROTECTED]> wrote: > Hi, > > Is anobody aware of this post: http://swtch.com/~rsc/regexp/regexp1.html ? Yes, it's been brought up here, on python-dev and python-ideas several times in the past year and a half. > Are there any plans to speed u

Re: segfault matplotlib with Python2.6

2008-11-17 Thread Jerry Hill
On Mon, Nov 17, 2008 at 5:58 PM, Magdoll <[EMAIL PROTECTED]> wrote: > Has anyone run into the same problem I have? I used to run matplotlib > with Python2.5 and everything worked fine. Now I use Python2.6, and > everything falls apart. > > I installed numpy, libpng, and freetype as required by matp

Re: 404 not found on for Python 2.6 Itanium

2008-11-19 Thread Jerry Hill
On Wed, Nov 19, 2008 at 4:12 PM, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: >> Then why is there a link on the download site? > > Where specifically did you spot that link? I can't see any. I believe the link in question is on the page http://www.python.org/download/ titled "Python 2.6 Windows I

Re: Python not importing mysqldb

2009-04-24 Thread Jerry Hill
On Fri, Apr 24, 2009 at 4:04 PM, 83nini <83n...@gmail.com> wrote: > hi guys, > > i've been sweating the whole day trying to make python work with mysql > but in vain! > i'm doing the following: > 1. visiting http://sourceforge.net/projects/mysql-python > 2. dowloading mysql-python-test-1.2.3c1 > 3.

Re: Collections.py -- any help?

2009-04-24 Thread Jerry Hill
On Fri, Apr 24, 2009 at 6:56 PM, Josh English wrote: > In my quest to learn more, I've been trying to get the collections.py > module to do anything but look cool. So far, it's only a cool idea. > How do they work? I can't find a tutorial on the web anywhere > explaining how I would use them in my

<    1   2   3   4   >