Re: [Tutor] Numpy unexpected result: subtraction of cell values

2010-01-11 Thread Marc Tompkins
On Mon, Jan 11, 2010 at 10:20 AM, Carnell, James E < jecarn...@saintfrancis.com> wrote: > > I'm sure this is easy, but I am having a difficult time finding the right > search terms to find it on the Internet. Any help much appreciated. > > 3 dimensional array(x,y,rgb) which is a PIL image into a n

Re: [Tutor] Numpy unexpected result: subtraction of cell values

2010-01-11 Thread Marc Tompkins
On Mon, Jan 11, 2010 at 11:02 AM, Carnell, James E < jecarn...@saintfrancis.com> wrote: > > > > > I'm sure this is easy, but I am having a difficult time finding the > > right search terms to find it on the Internet. Any help much > > appreciated. > > > > 3 dimensional array(x,y,rgb) which is a PI

Re: [Tutor] Guess my number? Guess what's wrong!

2010-04-17 Thread Marc Tompkins
On Sat, Apr 17, 2010 at 1:04 PM, Matthew Carpenter-Arevalo < matthew.carpenter.arev...@googlemail.com> wrote: > Hi Everyone, > > I'm a beginner python programmer, and I've been working on > the perennial 'guess my number' example. > > When I run this in my module, I get an infinite loop of 'higher

Re: [Tutor] Boa Constructor list control

2010-04-29 Thread Marc Tompkins
On Thu, Apr 29, 2010 at 11:07 PM, Ray Parrish wrote: > OK, I've discovered the collection editor, and now know how to use it, but > when I click the new button in the collection editor for a list control, it > pops up an error message stating that the list needs to be created with the > wx.LC_REP

Re: [Tutor] OT: need computer advice from wise Tutors

2010-06-26 Thread Marc Tompkins
On Sat, Jun 26, 2010 at 2:30 PM, Richard D. Moores wrote: > On Sat, Jun 26, 2010 at 13:39, Sithembewena Lloyd Dube > wrote: > > Hi Dick, > > > > In that case, perhaps you could externally back up all your important > stuff > > and then format your hard disk. That way, any drivers etc intended for

Re: [Tutor] OT: need computer advice from wise Tutors

2010-06-27 Thread Marc Tompkins
On Sat, Jun 26, 2010 at 4:46 PM, Steven D'Aprano wrote: > Apart from: > The OP was asking about upgrading from Vista to 7, so let me answer your objections here... having no default email client (what sort of two-bit operating system > doesn't have an email client in 2010?); > Jesus, you _miss_

Re: [Tutor] OT: need computer advice from wise Tutors

2010-06-27 Thread Marc Tompkins
On Sun, Jun 27, 2010 at 7:41 AM, Alan Gauld wrote: > "Marc Tompkins" wrote > > having no default email client (what sort of two-bit operating system >> >>> doesn't have an email client in 2010?); >>> >>> Jesus, you _miss_ Outlook Expres

Re: [Tutor] TypeError when io.open is used

2010-06-27 Thread Marc Tompkins
On Sun, Jun 27, 2010 at 3:20 PM, wrote: > I have tried the following, too: > > from pg8000 import DBAPI > import os > import os.path > import sys > > # !!! that is test data. It must be changed > conn=DBAPI.connect(host="localhost", database="postgres", user="postgres", > password="test") > > #co

Re: [Tutor] TypeError when io.open is used

2010-06-27 Thread Marc Tompkins
On Sun, Jun 27, 2010 at 5:13 PM, wrote: > On Sun, 27 Jun 2010 15:56:23 -0700 > Marc Tompkins wrote: > >> On Sun, Jun 27, 2010 at 3:20 PM, wrote: >> >> I don't have any insight into your other piece of code, but here I think >> you >> just need ano

Re: [Tutor] Problems installing

2010-06-29 Thread Marc Tompkins
On Tue, Jun 29, 2010 at 10:35 PM, Andrew Martin wrote: > I just downloaded Python 2.6.5 onto my windows vista laptop. I am > attempting to install "escript version 3: Solution of Partial Differential > Equations (PDE) using Finite Elements (FEM)." I downloaded the files and > manually placed them

Re: [Tutor] Difficulty Understanding Example Code for Blender Script

2010-07-21 Thread Marc Tompkins
On Wed, Jul 21, 2010 at 9:48 PM, Andrew Martin wrote: > This code was part of a Blender script to build a 3d bar graph, so I don't > know if understanding Blender is a prereq for understanding this code. The > function is for the axis labels. > > def label(text,position,orientation='z'): > txt

Re: [Tutor] Databases in Python

2010-08-24 Thread Marc Tompkins
On Tue, Aug 24, 2010 at 12:44 PM, aug dawg wrote: > if searcher in database: >> # Figure this out. >> >> You need some sort of actual Python statement there as a placeholder - even just "print()". -- www.fsrtechnologies.com ___ Tutor maillist - Tut

Re: [Tutor] Newbie - regex question

2010-08-30 Thread Marc Tompkins
On Mon, Aug 30, 2010 at 2:56 PM, Hugo Arts wrote: > To solve, we have the non-greedy patterns. They eat not as much > possible, but as little as possible. To make a qualifier non-greedy, > simply add an asterix at its end: > > r'WORD1-.*?' > > I would also like to offer one small correction: an a

Re: [Tutor] a logic problem in an if statement

2010-09-26 Thread Marc Tompkins
On Sun, Sep 26, 2010 at 1:01 PM, Bill Allen wrote: > > Any thoughts how I am going wrong here? > > Looks like you've got two different names for the first mouse click... mouse_pos1 = mouse_pos > but > if mouse_pos[1] < height/2 and mouse_pos2[1] > height/2: > -- www.fsrtechnologies.

Re: [Tutor] a logic problem in an if statement

2010-09-26 Thread Marc Tompkins
On Sun, Sep 26, 2010 at 1:36 PM, Bill Allen wrote: > I hate it when I do something like that!A combination of poor choice of > names for the variables and programming tunnel vision > Been there, done that! -- www.fsrtechnologies.com ___ Tutor

Re: [Tutor] Issues In Terminal

2010-09-26 Thread Marc Tompkins
On Sun, Sep 26, 2010 at 2:55 PM, Bill DeBroglie wrote: > Which is great, but when I try and run the same code in the Terminal by > calling a program I've written (print("hello world") again) I get the > following: > >matthews-macbook:Dawson_Book matthewparrilla$ ./chapter_2.py >./c

Re: [Tutor] Issues In Terminal

2010-09-26 Thread Marc Tompkins
On Sun, Sep 26, 2010 at 3:04 PM, David Hutto wrote: > > Pretty sure it's the parentheses, but I'm not an expert. In python 3 you > use > > print(), in 2.6 you either use import from __futur__ or print "string > here". > > I mean __future__ . > The parentheses are optional in 2.6, mandatory in 3.

Re: [Tutor] Issues In Terminal

2010-09-26 Thread Marc Tompkins
On Sun, Sep 26, 2010 at 3:24 PM, Bill DeBroglie wrote: > > Is this what you mean? > > matthew-parrillas-macbook:Dawson_Book matthewparrilla$ #!/usr/bin/env > python > matthew-parrillas-macbook:Dawson_Book matthewparrilla$ ./chapter_2.py > ./chapter_2.py: line 1: syntax error near unexpected token

Re: [Tutor] IDEs

2010-11-22 Thread Marc Tompkins
On Mon, Nov 22, 2010 at 1:13 AM, Josep M. Fontana wrote: > Alan gave me this piece of advice in his response to another message I > sent to the list. Since the topic is a bit different from the one in > the original message, I think it is better to start a different > thread. > > > Don;t run your

Re: [Tutor] Copy file function works, but not with adding the date copied

2009-02-13 Thread Marc Tompkins
On Fri, Feb 13, 2009 at 11:11 AM, Alan Gauld wrote: > >> {\rtf1\mac\ansicpg1\cocoartf824\cocoasubrtf440 >> > > The problem is that this is an RTF format which is a binary format. > You can process binary data ion Python (see the box on the files > topic page) but it is much more difficult that

Re: [Tutor] Copy file function works, but not with adding the date copied

2009-02-13 Thread Marc Tompkins
On Fri, Feb 13, 2009 at 11:35 AM, Marc Tompkins wrote: > On Fri, Feb 13, 2009 at 11:11 AM, Alan Gauld wrote: > >> >>> {\rtf1\mac\ansicpg1\cocoartf824\cocoasubrtf440 >>> >> Here's a quick-and-dirty way to do what (I think) you want to do: Skip the fi

[Tutor] Fwd: Extract image from RTF file

2009-02-14 Thread Marc Tompkins
Forgot to Reply All. -- Forwarded message -- From: Marc Tompkins Date: Sat, Feb 14, 2009 at 11:35 AM Subject: Re: [Tutor] Extract image from RTF file To: Bryan Fodness On Sat, Feb 14, 2009 at 8:40 AM, Bryan Fodness wrote: > I have a large amount of RTF files where the o

Re: [Tutor] exec "self.abc=22" ?

2009-02-16 Thread Marc Tompkins
On Mon, Feb 16, 2009 at 11:58 AM, Wayne Watson wrote: > Python doesn't like the code in the Subject (unqualified exec not allowed > in function). but easily likes self.abc="22". However, I'd like to assemble > the assignment as a string, as shown in Subject, and execute it. Is there a > way to d

Re: [Tutor] Changing the Attribute of a Variable

2009-02-16 Thread Marc Tompkins
On Mon, Feb 16, 2009 at 8:24 PM, Wayne Watson wrote: > I suspect I'm in need of setattr for this in a GUI program I'm modifying. > > Initally, a variable. self.stop_time is created as type datetime.time, with > the default value 06:00:00, a time stamp, during entry into the mainloop. > self.stop_

Re: [Tutor] Changing the Attribute of a Variable

2009-02-17 Thread Marc Tompkins
On Tue, Feb 17, 2009 at 12:16 AM, wesley chun wrote: > marc: i will slightly disagree with you with regards to strftime *not* > being an attribute. it *is* an attribute, just not a *data > attribute*... i call it a "function attribute," but that's just > terminology. any time you have an object x

Re: [Tutor] Changing the Attribute of a Variable

2009-02-17 Thread Marc Tompkins
On Tue, Feb 17, 2009 at 4:44 AM, Wayne Watson wrote: > Note that the diagnostic output in the image shows attributeError: 'str' > object has no attribute 'strftime'. > > Let me see if I clarify what's really going on by including some of the > code. > Everything in Python - both variables and cod

Re: [Tutor] Changing the Attribute of a Variable

2009-02-17 Thread Marc Tompkins
On Tue, Feb 17, 2009 at 11:01 AM, Wayne Watson wrote: > Here's the print from the code line below. > > Second line from the top. > There it is - stop_time is a str at this point in the program, so has no strftime attribute or method. Step back through your code and see why... I find Control-F

Re: [Tutor] Changing the Attribute of a Variable

2009-02-18 Thread Marc Tompkins
On Tue, Feb 17, 2009 at 7:09 PM, Wayne Watson wrote: I have a few notes, but first I just have to say: you're working very hard to implement an ordered dictionary, and you really, really don't need to. Python's (unordered) dictionaries work just fine for reading and writing configurations; you jus

Re: [Tutor] Looking for ConfigObj Documentation

2009-02-18 Thread Marc Tompkins
On Wed, Feb 18, 2009 at 7:30 AM, Wayne Watson wrote: > See Subject. I've run across a 58 page document > , > but am uncertain of its applicability to my present needs (see my thread on > "Changin

Re: [Tutor] Looking for ConfigObj Documentation

2009-02-18 Thread Marc Tompkins
important that the script not have the same name as a standard module, or Python will attempt to load the script as a module when that module is imported. This will generally be an error. See section *Standard Modules* <http://docs.python.org/tutorial/modules.html#tut-standardmodules>for more infor

Re: [Tutor] Looking for ConfigObj Documentation

2009-02-18 Thread Marc Tompkins
On Wed, Feb 18, 2009 at 2:57 PM, Wayne Watson wrote: > Thanks. I recall installing several libraries though, where somehow they > were packaged to automatically install when opened. > > In the >

Re: [Tutor] Looking for ConfigObj Documentation

2009-02-18 Thread Marc Tompkins
On Wed, Feb 18, 2009 at 7:42 PM, Wayne Watson wrote: > I took your "starter" code, and formatted it to be what I hope is an > acceptable program, Gobal_Config.py. See attached. I'm using Python 2.5.2. > I put the two modules in the same folder with it, and executed it in IDLE. I > got this: >

Re: [Tutor] Looking for ConfigObj Documentation

2009-02-19 Thread Marc Tompkins
On Thu, Feb 19, 2009 at 4:51 AM, Wayne Watson wrote: > Hi, actually I had two aims with the pseudo code, 1. print it, and 2. > check to see if it would pull in the two modules. I pulled it into Word, and > quickly formatted it to get the line wrap out, and put it in some sort of > readable format

Re: [Tutor] Looking for ConfigObj Documentation

2009-02-19 Thread Marc Tompkins
On Thu, Feb 19, 2009 at 9:58 AM, Wayne Watson wrote: > I now have wxPython, IDLE and Vim installed. IDLE didn't disappear during > the wx install. It looks as though wxPython re-compiled library files. I'll > be exploring vim now. > wxPython doesn't replace or remove anything - I still have IDL

Re: [Tutor] Looking for ConfigObj Documentation

2009-02-19 Thread Marc Tompkins
On Thu, Feb 19, 2009 at 10:59 AM, Wayne Watson wrote: > I'm willing to give vim a shot. I believe in an earlier thread unrelated to > this, Alan suggested it. I'm perhaps incorrectly assuming vim will take care > of the Tkinter problem. If these editors aren't really the source of some > the err

Re: [Tutor] Removing control characters

2009-02-19 Thread Marc Tompkins
On Thu, Feb 19, 2009 at 11:25 AM, Dinesh B Vadhia wrote: > My solution is: > > print ''.join[string.replace(c, r) for c in str if c in set] > > But, this returns a syntax error. Any idea why? > Probably because you didn't use parentheses - join() is a function. -- www.fsrtechnologies.com

Re: [Tutor] KeyError: 'DEFAULT'

2009-02-19 Thread Marc Tompkins
On Thu, Feb 19, 2009 at 11:34 AM, Isaac Eiland-Hall wrote: > http://python.pastebin.com/m26864a1b > > > > Traceback (most recent call last): > > File "./loopy", line 328, in > > > set[current_set][current_section][current_key] = current_value > > KeyError: 'DEFAULT' > One thing p

Re: [Tutor] KeyError: 'DEFAULT'

2009-02-19 Thread Marc Tompkins
On Thu, Feb 19, 2009 at 8:39 PM, Lie Ryan wrote: > On Thu, 19 Feb 2009 11:45:52 -0800, Marc Tompkins wrote: > > Don't use reserved words as variable names! > > > str, set is built-in function not reserved words. Reserved words are like > if, for, from, as (see the w

Re: [Tutor] Looking for ConfigObj Documentation

2009-02-20 Thread Marc Tompkins
On Fri, Feb 20, 2009 at 9:45 AM, Wayne Watson wrote: > Marc, I'm reaching back here, since something seems to have gone awry. I'm > looking at the code for Global_Config1.py. When I execute it from IDLE, I > get again: > > ... > File > "C:\Sandia_Meteors\New_Sentinel_Development\Sentuser_Utilit

Re: [Tutor] Looking for ConfigObj Documentation

2009-02-20 Thread Marc Tompkins
On Fri, Feb 20, 2009 at 10:45 AM, Paul McGuire wrote: > Has anyone already mentioned the article in Python Magazine, May, 2008? > No, I for one haven't seen it. Is it available online, or only for subscribers? -- www.fsrtechnologies.com ___ Tutor m

Re: [Tutor] Looking for ConfigObj Documentation

2009-02-20 Thread Marc Tompkins
On Fri, Feb 20, 2009 at 5:05 PM, Wayne Watson wrote: > Not because of this particular problem, but, out of curiosity, I tried > today to give the MS command line facility a shot. I think that's what we > are discussing here. I immediately ran into something of a problem. My > assumption was is wa

Re: [Tutor] Looking for ConfigObj Documentation

2009-02-21 Thread Marc Tompkins
On Sat, Feb 21, 2009 at 6:42 PM, Wayne Watson wrote: > I tried XP's Help on command prompts. Not much there. Is there another > source? > There are lots, and Google knows most of them - here's a good one to start with: http://www.ss64.com/nt/ -- www.fsrtechnologies.com

Re: [Tutor] Looking for ConfigObj Documentation

2009-02-21 Thread Marc Tompkins
On Sat, Feb 21, 2009 at 8:26 PM, Wayne Watson wrote: > I've found others like that, but I was looking for something more > descriptive. Things like typing fill-in, or cut/paste, use of F8, etc. I'd > guess there are more. > Click through a little further: http://www.ss64.com/nt/cmd.html Should t

Re: [Tutor] Looking for ConfigObj Documentation

2009-02-21 Thread Marc Tompkins
On Fri, Feb 20, 2009 at 2:19 PM, Wayne Watson wrote: > Good. Thanks. It works fine for me now. I deleted the file. I just ran > the program again straight from the py file, and it put my the black window > with my raw_input prompt. It seems odd that it wouldn't have left text > debris when it c

Re: [Tutor] Converting "HH:MM:SS" to datetime

2009-03-01 Thread Marc Tompkins
On Sun, Mar 1, 2009 at 10:04 AM, Wayne Watson wrote: > Ok, how do I do what's mentioned in Subject? > One thing to be aware of - Python datetimes are just that: date + time. If you specify only the time, the date will be filled in with a default value - generally the beginning of the epoch for

Re: [Tutor] What is this [] construction?

2009-03-03 Thread Marc Tompkins
On Mon, Mar 2, 2009 at 11:18 PM, Andre Engels wrote: > On Tue, Mar 3, 2009 at 4:54 AM, Wayne Watson > wrote: > >self.recent_events = [ event for event in self.recent_events > >if os.path.exists(event) and > >(time.time() - o

Re: [Tutor] What is this [] construction?

2009-03-03 Thread Marc Tompkins
On Tue, Mar 3, 2009 at 7:01 PM, Lie Ryan wrote: > Marc Tompkins wrote: > > List comprehensions will make your head hurt the first few dozen times > >> you encounter them. After that, they become easier to use than the longer >> for-loop structure they replace - as Andr

Re: [Tutor] What is this [] construction?

2009-03-04 Thread Marc Tompkins
On Tue, Mar 3, 2009 at 11:56 PM, Alan Gauld wrote: > > In Python v3 list comprehensions and generator expressions have been > "merged" in that putting a GE inside [] has the same effect as a LC. In > practice this makes little or no difference to the programmer its just how > Python handles it beh

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-20 Thread Marc Tompkins
On Fri, Mar 20, 2009 at 8:46 AM, Wayne Watson wrote: > I guess I haven't made clear above. This is a Red Hat Linux compiled C > program. Indications from others above, suggest it is possible to execute it > under Win Python. If that's true, then my guess is that something prior to > the call must

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-20 Thread Marc Tompkins
On Fri, Mar 20, 2009 at 10:02 AM, Marc Tompkins wrote: > If you want to run a non-Windows executable on Windows, you need to use an > alternate shell - someone mentioned Cygwin - although I'm not certain that > even that will do it for you. What makes an executable OS-specifi

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-20 Thread Marc Tompkins
On Fri, Mar 20, 2009 at 10:02 AM, Marc Tompkins wrote: > Neither Python proper nor Popen() are actually executing the program - the > Windows shell/command interpreter does that (command.com or cmd.exe, > depending on your Windows version); Popen() is just a mechanism for making >

Re: [Tutor] Syntax error

2009-03-22 Thread Marc Tompkins
On Sun, Mar 22, 2009 at 8:35 PM, John Jenkinson wrote: > I am trying to write a program that displays the string expression "Game > Over", in a console window that remains open. > > my code is as follows: > > # Game Over console window > > print "Game Over" > raw input("\n\nPress the enter key to

Re: [Tutor] printing files

2009-03-26 Thread Marc Tompkins
On Thu, Mar 26, 2009 at 10:42 AM, Bala subramanian < bala.biophys...@gmail.com> wrote: >print>>out, handle <-- Here i want to write only from second line. I > dnt want to loop over handle here and putting all lines except the first one > in > anothe

Re: [Tutor] printing files

2009-03-26 Thread Marc Tompkins
On Thu, Mar 26, 2009 at 10:56 AM, Marc Tompkins wrote: > Without changing anything else, you could do it with a slice: > You should probably also close your input files when you're done with them. -- www.fsrtechnologies.com ___ Tut

Re: [Tutor] why is unicode converted file double spaced?

2009-04-07 Thread Marc Tompkins
On Tue, Apr 7, 2009 at 9:52 AM, Pirritano, Matthew wrote: > So Kent's syntax worked to convert my Unicode file to plain text. But > now my data is double space. How can I fix this. Here is the code I'm > using. > Sounds like you're being stung by the difference in newline handling between operat

Re: [Tutor] why is unicode converted file double spaced?

2009-04-07 Thread Marc Tompkins
On Tue, Apr 7, 2009 at 10:26 AM, Pirritano, Matthew wrote: > Thanks Marc, > > > > But I think that got rid of all of my carriage returns. Everything on just > one line now. > Sorry! My bad! Try this instead: > for outLine in inp: > outp.write(outLine.strip() + '\n') > _

Re: [Tutor] why is unicode converted file double spaced?

2009-04-07 Thread Marc Tompkins
On Tue, Apr 7, 2009 at 10:52 AM, Kent Johnson wrote: > You really should use rstrip(), leading white space is generally > significant in a text file, trailing white space not so much. > Good point. -- www.fsrtechnologies.com ___ Tutor maillist - Tu

Re: [Tutor] why is unicode converted file double spaced?

2009-04-07 Thread Marc Tompkins
On Tue, Apr 7, 2009 at 10:57 AM, Pirritano, Matthew wrote: > Excellent! Thanks Marc, Kent, and everyone. Marc your code worked. Now to > see if it will run on the full 4.5 GB file! : ) > Glad to help - but you should definitely take Kent's advice and replace my strip() with rstrip(). Good luck!

Re: [Tutor] why is unicode converted file double spaced?

2009-04-07 Thread Marc Tompkins
On Tue, Apr 7, 2009 at 11:59 AM, Pirritano, Matthew wrote: > I did get an error… > > > > Traceback (most recent call last): > > File "C:\Projects\unicode_convert.py", line 8, in > > outp.write(outLine.strip()+'\n') > > UnicodeEncodeError: 'ascii' codec can't encode characters in position >

Re: [Tutor] delphi, pascal and Python

2009-05-20 Thread Marc Tompkins
On Wed, May 20, 2009 at 11:10 AM, Alan Gauld wrote: > > "Andy Cheesman" wrote > > Is there a Method for wrapping delphi and/or pascal code into python like >> SWIG? >> I've googled to no avail, Can anyone help me? >> > > Try this: > > http://membres.lycos.fr/marat/delphi/python.htm > > Alan G >

Re: [Tutor] Needing Help

2009-06-30 Thread Marc Tompkins
On Tue, Jun 30, 2009 at 12:27 PM, Bob Rea wrote: > Why doe sit work with a dob in 1943 and not with one in 1980 > then, that's what really bugs me > Nothing to do with the year. Your birth month is BEFORE June; her birth month is after. -- www.fsrtechnologies.com __

Re: [Tutor] When are strings interned?

2009-07-01 Thread Marc Tompkins
On Wed, Jul 1, 2009 at 5:29 PM, Robert Berman wrote: > > >>> n = "colourless" > > >>> o = "colourless" > > >>> n == o > > True > > >>> n is o > > True > > >>> p = "green ideas" > > >>> q = "green ideas" > > >>> p == q > > True > > >>> p is q > > False > > > > Why the difference? > > The string p

Re: [Tutor] if: else: can not get else to work

2009-07-07 Thread Marc Tompkins
On Tue, Jul 7, 2009 at 6:36 PM, David wrote: > My question is I tried to get it to print out when the directory was empty > like this; > > for file in fobj: >pathname = os.path.join(folder, file) >if os.path.exists(pathname): >print 'removing... ', file >os.remove(pathname

Re: [Tutor] No Elegant XML Output in ElementTree?

2009-07-27 Thread Marc Tompkins
On Mon, Jul 27, 2009 at 8:32 PM, Luis Galvan wrote: > Hi tutors, > Okay, so I just started to learn ElementTree (and XML processing in > general) and I just can't, for the life of me, find a way to output the XML > file in an actual hierarchic presentation. What you want is generically called "p

Re: [Tutor] New guy question...

2009-09-14 Thread Marc Tompkins
On Mon, Sep 14, 2009 at 12:30 PM, Warren wrote: > Type integers, each followed by ENTER; or just ENTER to finish > Traceback (most recent call last): >  method in test.py at line 9 >    line = input() > EOFError: EOF when reading a line > > Why is the "input" statement not waiting for input like

Re: [Tutor] What language should I learn after Python?

2009-10-06 Thread Marc Tompkins
On Tue, Oct 6, 2009 at 12:39 PM, Mark Young wrote: > I'm now fairly familiar with Python, so I'm thinking about starting to > learn a second programming language. The problem is, I don't know which to > learn. I want a language that will be good for me to learn, but is not so > different from pyt

Re: [Tutor] Sleep

2009-10-07 Thread Marc Tompkins
On Wed, Oct 7, 2009 at 4:01 PM, Hristos Giannopoulos wrote: > Is it possible for a python script to make a windows computer sleep or wake > from sleep? Preferably in windows? > I think your best bet for controlling Windows power management with Python will be the pywin32 module, at http://sourcef

Re: [Tutor] Iterable Understanding

2009-11-15 Thread Marc Tompkins
On Sun, Nov 15, 2009 at 4:11 PM, Stephen Nelson-Smith wrote: > > import gzip > > from heapq import heappush, heappop, merge > > Is this a preferred method, rather than just 'import heapq'? > > It has a couple of advantages: - convenience: if you "import heapq", then to do a push you need to type

Re: [Tutor] No beep from winsound.Beep(500, 500)

2009-12-19 Thread Marc Tompkins
Richard - It works (in Python 2.6, mind you) on my 64-bit Win7 machine, but I suspect that that may be because of Microsoft's compatibility twiddling on the back end. I Googled, and there seem to be a number of reports of people having trouble with 64-bit Vista and winsound.Beep(). I suspect tha

[Tutor] In-place expansion of list members... possible?

2007-11-07 Thread Marc Tompkins
This question has probably been asked and answered many times, but I can't figure out how to word my question to get relevant results from Google. So I thought I'd try some human beings, eh? I'm working with delimited files (ANSI X12 EDI nonsense, to be precise.) First I load the records to a lis

Re: [Tutor] In-place expansion of list members... possible?

2007-11-07 Thread Marc Tompkins
Try this (untested code): for index in xrange(0, len(tmpSegs)): tmpSegs[index] = tmpSegs[index].split(self.ElemSep) Thank you - that works nicely, and it's a much better replacement for something else I was doing to achieve the same result (you know, the old count+=1 nonsense - every day, in

Re: [Tutor] In-place expansion of list members... possible?

2007-11-07 Thread Marc Tompkins
> > What puzzles me most is that I can replace 'seg' with just about > > anything else - > > for seg in tmpSegs: > > seg = seg.strip() > > or > > for seg in tmpSegs: > > seg = 'bananas' > > or > > for seg in tmpSegs: > > seg = seg + ' bana

[Tutor] XP environment variables (was: Wrong version of Python being executed)

2007-11-12 Thread Marc Tompkins
Thus spake Alan G: > > Note, these are entered in Ctrl Panel, System environment variables, > > NOT at the command line. > > Umm, have you rebooted? Probably an obvious step but I don't > think environment vars get reset in real time. They didn't used > to on NT but that may have changed in W2K or

Re: [Tutor] XP environment variables (was: Wrong version of Python being executed)

2007-11-12 Thread Marc Tompkins
Glad to help! It wouldn't have occurred to me as quickly as it did, except that I use Sysinternals' Process Explorer as a Task Mangler replacement - it allows you to see a hierarchical list of processes, as well as the usual sorted lists - and a week or two ago I happened to notice that CMD was ru

Re: [Tutor] Obtaining image date of creation

2007-11-14 Thread Marc Tompkins
Thus spake Roy Chen: > Hello, > > I would like to write a simple script that would rename a bunch of > photos according to their creation date, i.e. the date which the > photo was taken. > > Is there a way to use Python to obtain that information from the > image file, or is that information not s

Re: [Tutor] Memory consumption question

2007-11-15 Thread Marc Tompkins
Thus spake Bart Cramer: > I have a question... : > > >>> class A: pass > ... > >>> class B(object) : pass > ... > >>> dir(A) > ['__doc__', '__module__'] > >>> dir(B) > ['__class__', '__delattr__', '__dict__', '__doc__', '__getattribute__', > '__hash__', '__init__', '__module__', '__new__', '__redu

Re: [Tutor] Memory consumption question

2007-11-15 Thread Marc Tompkins
c" class, lots of options remain unresolved - slots vs. dict comes to mind - and Python needs to reserve extra space accordingly. About 134 extra bytes, it would appear. On Nov 15, 2007 9:32 AM, Kent Johnson <[EMAIL PROTECTED]> wrote: > Marc Tompkins wrote: > > > class B

Re: [Tutor] Memory consumption question

2007-11-15 Thread Marc Tompkins
e cook - but I gotta figure that the second option will take less space to write on the check. Perhaps about 134 bytes' worth. For some reason I'm hungry now... On Nov 15, 2007 11:22 AM, Kent Johnson <[EMAIL PROTECTED]> wrote: > Marc Tompkins wrote: > > I didn't mean t

Re: [Tutor] Memory consumption question

2007-11-15 Thread Marc Tompkins
And here's another reason to use new-style: I forgot the sauerkraut! Oh, the horror! On Nov 15, 2007 1:42 PM, Marc Tompkins <[EMAIL PROTECTED]> wrote: > I thought of an analogy I like better than my sign-painting one: ordering > a sandwich. > Imagine: you're at the de

Re: [Tutor] Memory consumption question

2007-11-15 Thread Marc Tompkins
the analogy is cute, but I really don't know what it means in > Python. Can you give an example? What are the parts of an old-style > class that have to be 'ordered' separately? How do you 'order' them > concisely with a new-style class? > > Thanks, > Kent

Re: [Tutor] Memory consumption question

2007-11-15 Thread Marc Tompkins
Sorry, sloppy cutting and pasting. Should be: Referring to the original post: > > > >>> dir(A) > > ['__doc__', '__module__'] > > >>> dir(B) > > ['__class__', '__delattr__', '__dict__', '__doc__', '__getattribute__', > > '__hash__', '__init__', '__module__', '__new__', '__reduce__', > > '__reduce_

[Tutor] Read-ahead for large fixed-width binary files?

2007-11-16 Thread Marc Tompkins
I've been writing a lot of utility programs for my clients who are users of a certain legacy database application - exporting, reporting, pretty label printing, etc. The database is normalized into 45 files, each of which contains fixed-length records (ranging from 80 bytes to 1024). A few of tho

Re: [Tutor] Read-ahead for large fixed-width binary files?

2007-11-16 Thread Marc Tompkins
OK, I feel quite foolish... almost immediately after hitting 'send' I realized I can implement this myself, using 'read(bigsize)' - currently I'm using 'read(recordsize)'; I just need to add an extra loop around my record reads. Please disregard... On Nov 16, 2

Re: [Tutor] affecting all classes if one class is affected by an event - pygame

2007-11-16 Thread Marc Tompkins
Thus spake ted b: I am trying to figure out how to make a class instance respond the same way > as another class instance if the other is affected by some event. I have > been playing around with inheritance, and have tried other stuff, but i am > somewhat of a newbie and I have been having diffic

Re: [Tutor] Read-ahead for large fixed-width binary files?

2007-11-17 Thread Marc Tompkins
Alan Gauld wrote: "Marc Tompkins" <[EMAIL PROTECTED]> wrote > realized I can implement this myself, using 'read(bigsize)' - > currently I'm using 'read(recordsize)'; I just need to add an extra > loop around my record reads. Please disregard...

Re: [Tutor] Read-ahead for large fixed-width binary files?

2007-11-17 Thread Marc Tompkins
On Nov 17, 2007 8:14 PM, Kent Johnson <[EMAIL PROTECTED]> wrote: > Marc Tompkins wrote: > > My question is this: does anybody know of an equivalent to > > "readlines(sizehint)" for non-delimited, binary files? I've Googled > > and Googled until I'

Re: [Tutor] Read-ahead for large fixed-width binary files?

2007-11-17 Thread Marc Tompkins
bled) > I think my head's going to explode - my negative capacity is overloaded! On Nov 17, 2007 9:03 PM, Marc Tompkins <[EMAIL PROTECTED]> wrote: > On Nov 17, 2007 8:14 PM, Kent Johnson <[EMAIL PROTECTED]> wrote: > > > Marc Tompkins wrote: > > >

Re: [Tutor] Read-ahead for large fixed-width binary files?

2007-11-17 Thread Marc Tompkins
On Nov 17, 2007 8:20 PM, Kent Johnson <[EMAIL PROTECTED]> wrote: > I would wrap the record buffering into a generator function and probably > use plain slicing to return the individual records instead of StringIO. > I have a writeup on generators here: > > http://personalpages.tds.net/~kent37/kk/0

Re: [Tutor] Read-ahead for large fixed-width binary files?

2007-11-18 Thread Marc Tompkins
On Nov 18, 2007 5:15 AM, Kent Johnson <[EMAIL PROTECTED]> wrote: > Marc Tompkins wrote: > > On Nov 17, 2007 8:20 PM, Kent Johnson <[EMAIL PROTECTED] > > <mailto:[EMAIL PROTECTED]>> wrote: > > use plain slicing to return the individual records instea

[Tutor] Questions about wxEvents

2007-12-06 Thread Marc Tompkins
I have a specific question - how can I generalize a FileBrowseButtonWithHistory - and I realized, as I was trying to word my question, that my real question is a bit more generic. First, the specific question: The FileBrowseButtonWithHistory requires a callback override and some custom code to st

Re: [Tutor] Questions about wxEvents

2007-12-06 Thread Marc Tompkins
allback('fp2', x) > ) > [snip] > def fpCallback(self, controlID, evt): > print evt.__dict__ > print help(evt) > value = evt.GetString() > [snip] > > > > - Jeff Younker - [EMAIL PROTECTED] - > > > On

Re: [Tutor] Dynamically named objects

2007-12-28 Thread Marc Tompkins
Sorry, meant to respond to the list, not just the OP... -- Forwarded message -- From: Marc Tompkins <[EMAIL PROTECTED]> Date: Dec 28, 2007 12:13 AM Subject: Re: [Tutor] Dynamically named objects To: Michael Bernhard Arp Sørensen <[EMAIL PROTECTED]> I don't think

Re: [Tutor] Dynamically named objects

2007-12-28 Thread Marc Tompkins
Here's the same thing with a list instead of a dictionary: #=== class thingy(): example = "Just testing - " def __init__(self, num): self.example = self.example + str(num) thang = [] for x in range(1,4): thang.append(thingy(x)) for item,

Re: [Tutor] python CLI parser

2007-12-28 Thread Marc Tompkins
On Dec 28, 2007 2:11 AM, Simone <[EMAIL PROTECTED]> wrote: > bob gailer ha scritto: > > >> could you have a short review of my CLI package. > > .bz2??? What does that extension mean? (For us Windows folk). Or could > > you attach a simple zip file? > > .bz2 is an archive compressed with the bzip2

Re: [Tutor] Choice of GUI builders

2008-01-03 Thread Marc Tompkins
I'm using wxPython, after very brief forays into Tk and Qt, and I like it a lot. wx generally wraps the native widgets of whatever OS/desktop it runs on, and its idiom felt more comfortable to me than the others. Also, unlike Qt, it's free... I hate to be a cheapskate, but I'm a very small busines

Re: [Tutor] Choice of GUI builders

2008-01-03 Thread Marc Tompkins
On Jan 3, 2008 4:06 AM, Tiago Saboga <[EMAIL PROTECTED]> wrote: > But since 2005, according to wikipedia, the Qt Windows is also > licensed under the GPL. Am I missing something? > >From the Trolltech website: > *Qt Open Source Edition* is provided under the GNU General Public License > version 2

Re: [Tutor] Tutor Digest, Vol 47, Issue 8

2008-01-03 Thread Marc Tompkins
On Jan 3, 2008 1:24 PM, Tony Cappellini <[EMAIL PROTECTED]> wrote: > The point I was trying to make that didn't come across is: > Until one has enough experience to hand code the GUIs, the designers are > helpful and a good place to begin. > > The problem with widgets not appearing where they shou

Re: [Tutor] Tutor Digest, Vol 47, Issue 8

2008-01-03 Thread Marc Tompkins
On Jan 3, 2008 10:31 AM, Tony Cappellini <[EMAIL PROTECTED]> wrote: > Putting widgets into sizers is easy with the designers. Not knowing how > to fix your code when the widgets don't appear as you want them is a > problem. I've never seen any docs written to help overcome this for any > framewor

Re: [Tutor] Tutor Digest, Vol 47, Issue 8

2008-01-03 Thread Marc Tompkins
Let me clarify this: > But if, to achieve the proper level of proficiency with the designer, I > have to invest many hours of study and practice... well, it's going to be a > hard sell. I'd rather be coding. > An hour spent learning something new in Python makes me a better programmer, and proba

Re: [Tutor] Scope and elegance

2008-01-07 Thread Marc Tompkins
On Jan 7, 2008 12:07 PM, James Newton <[EMAIL PROTECTED]> wrote: > Hi Python Practicioners! > ... > I am not so much concerned in getting this to work (I can already do > that); I am more concerned with understanding how to treat this in the > most Pythonesque way. > I'd like to get the party lin

  1   2   3   4   5   >