Re: [Tutor] Outputting Data to Printer

2009-11-20 Thread Alan Gauld
Ken G. beach...@insightbb.com wrote Is there a Python command to send data to printer? I have a Canon MX300 hooked up by USB. I can print from Firefox and Thunderbird. I am using Ubuntu 9.04 and Python 2.6.2. There is no universal easy way to print stuff unfortunately. In console mode on

Re: [Tutor] copy zip file from source folder to destination and unzipall files within destination

2009-11-20 Thread Alan Gauld
MARCUS NG marker...@gmail.com wrote Currently nothing works due to my limited understanding. That's a pretty vague description of the problem. What exactly happens? Does the file get copied? Do you get error messages? If so what? I am wondering if my syntax is wrong or am I missing

Re: [Tutor] copy zip file from source folder to destination and unzip all files within destination

2009-11-20 Thread Lie Ryan
MARCUS NG wrote: Hey all, I have been searching online for ways to copy a zip file to a destination and extract the zip file with python. Currently nothing works due to my limited understanding. I am wondering if my syntax is wrong or am I missing anything? the code is as such. also if there

Re: [Tutor] Handling missing positional arguments

2009-11-20 Thread Kent Johnson
On Thu, Nov 19, 2009 at 5:47 PM, Geoff Dutton geoff.dut...@noaa.gov wrote: Do you have recommendations for handling missing positional arguments?  I'm a huge fan of OptionParser module and use it in several programs to handle options, but there must be an eligant way of handling missing

Re: [Tutor] Querying a packages modules?

2009-11-20 Thread Kent Johnson
On Thu, Nov 19, 2009 at 9:31 PM, Eric Pavey warp...@gmail.com wrote: Say I have this package layout \myPackage __init__.py moduleA.py moduleB.py Is there a way (and I'm sure there is...) to query, for a given package level, which modules live under it? I thought I could do it like so:

Re: [Tutor] copy zip file from source folder to destination and unzip all files within destination

2009-11-20 Thread Kent Johnson
On Fri, Nov 20, 2009 at 1:54 AM, MARCUS NG marker...@gmail.com wrote: Hey all, I have been searching online for ways to copy a zip file to a destination and extract the zip file with python. Currently nothing works due to my limited understanding. I am wondering if my syntax is wrong or am I

[Tutor] how to access deep classes

2009-11-20 Thread John
Hi, I'm not to sure I can explain myself. But I need to ask because I do not understand how it works or what is possible. class A (wx.Panel); def__init__(...) class B(wx.PyPanel): def __init__(..): self.pages = A(...) class C (B) def __init__(...) I can't change the code in

Re: [Tutor] Can a method be added to dictionary?

2009-11-20 Thread Lie Ryan
lau...@protopc.com wrote: John, Thank you so much for your help! -- Problem SOLVED!!! -- Your explanation and example was extremely helpful. I am very grateful. Lauren :-) if you want to pass an argument, you can curry the function with functools.partial() # currying the function, don't

Re: [Tutor] how to access deep classes

2009-11-20 Thread Lie Ryan
John wrote: Hi, I'm not to sure I can explain myself. But I need to ask because I do not understand how it works or what is possible. class A (wx.Panel); def__init__(...) class B(wx.PyPanel): def __init__(..): self.pages = A(...) class C (B) def __init__(...) I can't change

[Tutor] Replace try: except: finally:

2009-11-20 Thread Stephen Nelson-Smith
I need to make some code Python 2.4 compliant... the only thing I see is use of try: except: finally: To make this valid, I think I need to do a try: finally: and next try: except: inside. Is this correct? The code has; try: ... ... ... except SystemExit: raise except

Re: [Tutor] how to access deep classes

2009-11-20 Thread John
On Friday 20 November 2009 04:48:59 am Lie Ryan wrote: Is this what you want? class C(B):     �...@property      def wxpanelFontSize(self):          return self.pages.wxpanelFontSize     �...@wxpanelfontsize.setter      def wxpanelFontSize(self, value):          self.pages.wxpanelFontSize

Re: [Tutor] Outputting Data to Printer

2009-11-20 Thread Ken G.
Alan Gauld wrote: Ken G. beach...@insightbb.com wrote Is there a Python command to send data to printer? I have a Canon MX300 hooked up by USB. I can print from Firefox and Thunderbird. I am using Ubuntu 9.04 and Python 2.6.2. There is no universal easy way to print stuff unfortunately.

Re: [Tutor] Outputting Data to Printer

2009-11-20 Thread ALAN GAULD
There is no universal easy way to print stuff unfortunately. In console mode on Unix its not too bad, you can send data to lpr, just as you would from the shell. That is a surprise! I was so use to using lprint as in Basic. BASIC ran on a predefined platform so could be sure where

Re: [Tutor] Outputting Data to Printer

2009-11-20 Thread Ken G.
ALAN GAULD wrote: There is no universal easy way to print stuff unfortunately. In console mode on Unix its not too bad, you can send data to lpr, just as you would from the shell. That is a surprise! I was so use to using lprint as in Basic. BASIC ran on a predefined platform so

Re: [Tutor] Handling missing positional arguments

2009-11-20 Thread Geoff Dutton
On Fri, Nov 20, 2009 at 5:03 AM, Kent Johnson ken...@tds.net wrote: On Thu, Nov 19, 2009 at 5:47 PM, Geoff Dutton geoff.dut...@noaa.gov wrote: Do you have recommendations for handling missing positional arguments? I'm a huge fan of OptionParser module and use it in several programs to

Re: [Tutor] Replace try: except: finally:

2009-11-20 Thread Kent Johnson
On Fri, Nov 20, 2009 at 8:08 AM, Stephen Nelson-Smith sanel...@gmail.com wrote: I need to make some code Python 2.4 compliant... the only thing I see is use of try: except: finally: To make this valid, I think I need to do a try: finally: and next try: except: inside.  Is this correct? Yes,

Re: [Tutor] Querying a packages modules?

2009-11-20 Thread Eric Pavey
On Fri, Nov 20, 2009 at 4:09 AM, Kent Johnson ken...@tds.net wrote: On Thu, Nov 19, 2009 at 9:31 PM, Eric Pavey warp...@gmail.com wrote: Say I have this package layout \myPackage __init__.py moduleA.py moduleB.py Is there a way (and I'm sure there is...) to query, for a given

Re: [Tutor] Tutor Digest, Vol 69, Issue 96

2009-11-20 Thread rick
On Fri, 2009-11-20 at 16:40 +0100, tutor-requ...@python.org wrote: That is a surprise! I was so use to using lprint as in Basic. Oh well. I will have to study up on fmt and/or groff. Would those two commands (fmt, groff) send data to lpr from shell? Is lpr the same hookup for USB port?

[Tutor] Breaking out of loop...

2009-11-20 Thread Ken G.
I am trying to break out of a loop posted below. When asked for monthdate, it should break out if I entered the number zero and it does not. GRRR. Been working on this for almost an hour. monthdate = 999 while monthdate 0: monthdate = raw_input('Enter the month and date in

Re: [Tutor] Breaking out of loop...

2009-11-20 Thread Alan Gauld
Ken G. beach...@insightbb.com wrote I am trying to break out of a loop posted below. When asked for monthdate, it should break out if I entered the number zero and it does not. GRRR. Been working on this for almost an hour. monthdate = 999 while monthdate 0: You are comparing

Re: [Tutor] how to access deep classes

2009-11-20 Thread Alan Gauld
John jfabi...@yolo.com wrote class A (wx.Panel); def__init__(...) class B(wx.PyPanel): def __init__(..): self.pages = A(...) class C (B) def __init__(...) I can't change the code in either class A or class B. But I want to add a property to class A in class C. Is that possible?

Re: [Tutor] Breaking out of loop...

2009-11-20 Thread Ken G.
Alan Gauld wrote: Ken G. beach...@insightbb.com wrote I am trying to break out of a loop posted below. When asked for monthdate, it should break out if I entered the number zero and it does not. GRRR. Been working on this for almost an hour. monthdate = 999 while monthdate 0:

Re: [Tutor] Breaking out of loop...

2009-11-20 Thread Albert-Jan Roskam
Hi! Slightly different (extented) than your original question, but here's how I'd do this (although the program doesn't really do very much): import time, random def is_valid_date():     while True:     prompt = 'Enter the date in ISO format (-MM-DD), or 0 to exit: '     date =

Re: [Tutor] Can a method be added to dictionary?

2009-11-20 Thread Luke Paireepinart
Does the partial just do a lambda in the background? It's a neat example, thanks! I've never seen this used before. Sorry if reply is top-posted or otherwise weird, posting from mobile. On 11/20/09, Lie Ryan lie.1...@gmail.com wrote: lau...@protopc.com wrote: John, Thank you so much for your

Re: [Tutor] Querying a packages modules?

2009-11-20 Thread Dave Angel
Eric Pavey wrote: On Fri, Nov 20, 2009 at 4:09 AM, Kent Johnson ken...@tds.net wrote: On Thu, Nov 19, 2009 at 9:31 PM, Eric Pavey warp...@gmail.com wrote: Say I have this package layout \myPackage __init__.py moduleA.py moduleB.py Is there a way (and I'm sure there is...) to query,

Re: [Tutor] Querying a packages modules?

2009-11-20 Thread Eric Pavey
On Fri, Nov 20, 2009 at 10:40 AM, Dave Angel da...@ieee.org wrote: Eric Pavey wrote: On Fri, Nov 20, 2009 at 4:09 AM, Kent Johnson ken...@tds.net wrote: On Thu, Nov 19, 2009 at 9:31 PM, Eric Pavey warp...@gmail.com wrote: Say I have this package layout \myPackage __init__.py

Re: [Tutor] Querying a packages modules?

2009-11-20 Thread Eric Pavey
On Fri, Nov 20, 2009 at 10:58 AM, Eric Pavey warp...@gmail.com wrote: On Fri, Nov 20, 2009 at 10:40 AM, Dave Angel da...@ieee.org wrote: Eric Pavey wrote: On Fri, Nov 20, 2009 at 4:09 AM, Kent Johnson ken...@tds.net wrote: On Thu, Nov 19, 2009 at 9:31 PM, Eric Pavey warp...@gmail.com

Re: [Tutor] Querying a packages modules?

2009-11-20 Thread Dave Angel
Eric Pavey wrote: On Fri, Nov 20, 2009 at 11:14 AM, Eric Pavey warp...@gmail.com wrote: On Fri, Nov 20, 2009 at 10:58 AM, Eric Pavey warp...@gmail.com wrote: On Fri, Nov 20, 2009 at 10:40 AM, Dave Angel da...@ieee.org wrote: snip lol, in usual fashion, after I hack through

[Tutor] (no subject)

2009-11-20 Thread mark guinder
ok, all i know is that i have python installed on my computer(mac), and i know how to open up IDLE, how do i write my first program, what do i use , how do i open that, and how to i save it as a prograam? ___ Tutor maillist - Tutor@python.org To

Re: [Tutor] Querying a packages modules?

2009-11-20 Thread Kent Johnson
On Fri, Nov 20, 2009 at 3:05 PM, Dave Angel da...@ieee.org wrote: Eric Pavey wrote: lol, in usual fashion, after I hack through it, while in the docs, I find the 'fancy' solution: import pkgutil import myPackage modules = pkgutil.iter_modules(myPackage.__path__) for p in modules:    

[Tutor] Global Variables

2009-11-20 Thread Joseph Fennell
Quick introduction, I'm Joseph Fennell, and I've been playing with python for the past 6 years (primarily in the interpreter) and have finally gotten started on a full project and I've run into a small problem. I have defined some modules, and when I import them into the page I want to use them

Re: [Tutor] (no subject)

2009-11-20 Thread Wayne Werner
On Fri, Nov 20, 2009 at 1:42 PM, mark guinder mgsharky...@aim.com wrote: ok, all i know is that i have python installed on my computer(mac), and i know how to open up IDLE, how do i write my first program, what do i use , how do i open that, and how to i save it as a prograam? Try taking a

Re: [Tutor] Global Variables

2009-11-20 Thread Luke Paireepinart
On Fri, Nov 20, 2009 at 2:51 PM, Joseph Fennell josephfennells...@gmail.com wrote: Quick introduction, I'm Joseph Fennell, and I've been playing with python for the past 6 years (primarily in the interpreter) and have finally gotten started on a full project and I've run into a small

Re: [Tutor] Querying a packages modules?

2009-11-20 Thread Eric Pavey
On Fri, Nov 20, 2009 at 12:28 PM, Kent Johnson ken...@tds.net wrote: On Fri, Nov 20, 2009 at 3:05 PM, Dave Angel da...@ieee.org wrote: Eric Pavey wrote: lol, in usual fashion, after I hack through it, while in the docs, I find the 'fancy' solution: import pkgutil import myPackage

Re: [Tutor] how to access deep classes

2009-11-20 Thread John
On Friday 20 November 2009 09:48:38 am Alan Gauld wrote: John jfabi...@yolo.com wrote class A (wx.Panel); def__init__(...) class B(wx.PyPanel): def __init__(..): self.pages = A(...) class C (B) def __init__(...) I can't change the code in either class A or class

Re: [Tutor] Readable date arithmetic

2009-11-20 Thread bob gailer
Stephen Nelson-Smith wrote: I have the following method: def get_log_dates(the_date_we_want_data_for): t = time.strptime(the_date_we_want_data_for, '%Y%m%d') t2 = datetime.datetime(*t[:-2]) extra_day = datetime.timedelta(days=1) t3 = t2 + extra_day next_log_date =

Re: [Tutor] (no subject)

2009-11-20 Thread Alan Gauld
mark guinder mgsharky...@aim.com wrote ok, all i know is that i have python installed on my computer(mac), and i know how to open up IDLE, how do i write my first program, what do i use , how do i open that, and how to i save it as a prograam? That's slightly more than I assume for

Re: [Tutor] Global Variables

2009-11-20 Thread Alan Gauld
Joseph Fennell josephfennells...@gmail.com wrote I assume that it's because the variable is considered local and the imported functions are not technically local to that document. global in Python means in the same module not global across all modules You are best to pass data into

Re: [Tutor] Global Variables

2009-11-20 Thread Luke Paireepinart
On Fri, Nov 20, 2009 at 4:44 PM, Joseph Fennell josephfennells...@gmail.com wrote: My apologies yes these are in seperate files, -- main.py --- cHandler.execute(SELECT * FROM table) #sets results from above to nl nl = cHandler.fetchall() dn = raw_input(User