[Tutor] Global presets ?

2004-12-04 Thread Dave S
Hi there, I have some common data directories, like /home/dave/mygg/gg1.3/logs /home/dave/mygg/gg1.3/data /home/dave/mygg/gg1.3/datacore /home/dave/mygg/gg1.3/arch_data which increasing numbers of scripts are accessing. At the begining of each script I end up putting in declarations like arch_dat

Re: [Tutor] Global presets ?

2004-12-04 Thread Dave S
Thanks Guys, They are both good ways of getting round my problem, I appreciate your input & will have a play. Cheers Dave :-) :-) :-) :-) ___ Tutor maillist - [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Global presets ?

2004-12-04 Thread Dave S
Alan Gauld wrote: have you considered making the root directory an environment variable? That way you can read the value (os.getenv) at the start of the script. And if you ever need to move the structure you can simply change the environment value. It also means different users can use their own st

[Tutor] Accuracy of time.sleep()

2004-12-04 Thread Dave S
OK I may be pushing it, ;-) I need a script to sleep from any point to 8:05AM when in needs to re-start. So I calculate the number of seconds with the following def secs_till_805(): # Returns the number of seconds till 8:05AM secs_5min=5*60 secs_24hr=24*60*60 secs_8hr=(8*60*

Re: [Tutor] Accuracy of time.sleep()

2004-12-04 Thread Dave S
I expected the script to re-start 2-3 seconds after 8:05, python reloading after a long sleep etc, what I get is the script restarting at 08:04.55, earlier ??? OK this is not a world stopping problem, more of a curiosity. Any suggestions Dave Thanks for your input guys, I have used cron (fcr

Re: [Tutor] Accuracy of time.sleep()

2004-12-04 Thread Dave S
Tim Peters wrote: First, thank you for such a brilliant answer :-) [Dave S <[EMAIL PROTECTED]>] OK I may be pushing it, ;-) Yup . I need a script to sleep from any point to 8:05AM when in needs to re-start. So I calculate the number of seconds with the following def secs_ti

Re: [Tutor] Global presets ?

2004-12-04 Thread Dave S
Brian van den Broek wrote: Hi Dave, Kent, and all, I have a caution about the from Config import * idiom that Kent didn't mention. It can lead to namespace pollution, in that if you have a module 'foo' with a name 'bar' and you are witting a script which says from foo import * you have to be ver

Re: [Tutor] Accuracy of time.sleep()

2004-12-05 Thread Dave S
Jacob S. wrote: You know, since time.sleep() builds up errors, this is what I do to keep it purely pythonic... (not tested) from time import gmtime alarmhr = 8 alarmmin = 5 alarmsec = 0 while 1: t = gmtime() hour = t[3] min = t[4] sec = t[5] if (alarmhr,alarmmin,alarmsec) == (hour,mi

[Tutor] Python structure advice ?

2004-12-15 Thread Dave S
Im sorry to bang on about Python structure, but I do struggle with it, having in the past got into very bad habits with loads of BASIC where everything was global, and Forth, and hand coded 8031, 8051, 6502 I cant get my head round how you guys handle a modern structured language :-) (PS

Re: [Tutor] Python structure advice ?

2004-12-16 Thread Dave S
Dave S wrote: Im sorry to bang on about Python structure, but I do struggle with it, having in the past got into very bad habits with loads of BASIC where everything was global, and Forth, and hand coded 8031, 8051, 6502 I cant get my head round how you guys handle a modern structured

Re: [Tutor] Python structure advice ?

2004-12-17 Thread Dave S
Kent Johnson wrote: Dave S wrote: Dave S wrote: The 'remembering where is was' seems a continuous stumbling block for me. I have though of coding each module as a class but this seems like a cheat. I could declare copious globals, this seems messy, I could define each module as a th

Re: [Tutor] Python structure advice ?

2004-12-17 Thread Dave S
Sorry for the delay, real world work took me away ... everything was global, how you guys handle a modern structured language Don't worry this is one of the hardest bad habits to break. You are not alone. The easiest way is to just pass the data from function to function in the function pa

Re: [Tutor] Python structure advice ?

2004-12-17 Thread Dave S
Jeff Shannon wrote: Dave S wrote: Kent Johnson wrote: Why do you say this is 'cheaty'? A class is basically a collection of data (state) and functions to operate on that state. Sorry for the delay, real world work got in the way ... Well I understand classes to be used when multiple

Re: [Tutor] Python structure advice ?

2004-12-17 Thread Dave S
Alan Gauld wrote: 1) batch oriented - each step of the process produces its own output file or data structure and this gets picked up by the next stage. Tis usually involved processing data in chunks - writing the first dump after every 10th set of input say. I see your point, like a static

Re: [Tutor] Python structure advice ?

2004-12-17 Thread Dave S
Kent Johnson wrote: Dave S wrote: Separate modules is good. Separate directories for anything other than big programs (say 20 or more files?) is more hassle than its worth. The files are better kept in a single directory IMHO. The exception being modules designed for reuse... It just makes life

[Tutor] Problems with class, no output

2004-12-19 Thread Dave S
Hello again :-) , This script is very much a work in progress, and I think only the second time I have tried classes. What I expected it to do was to at least print 'hi there' so I know its alive, then dump some status info to my log program. It does zip, executes OK but no output. I just know

Re: [Tutor] Problems with class, no output

2004-12-19 Thread Dave S
Dave S wrote: Hello again :-) , This script is very much a work in progress, and I think only the second time I have tried classes. What I expected it to do was to at least print 'hi there' so I know its alive, then dump some status info to my log program. It does zip, executes

Re: [Tutor] Problems with class, no output

2004-12-19 Thread Dave S
Kent Johnson wrote: Dave, For some reason the indentation is very strange in this code. I think it must have something to do with how you posted it (or my mailer is messing it up?), as it would be a syntax error at runtime. If you can have more consistent indentation in your posts it will make t

[Tutor] Marry Xmas + httplib.py problem :)

2004-12-24 Thread Dave S
First, merry Xmas everyone, wishing you all well, :-) While my head is still clear ;-) , I have an unexpected problem. One of my apps which tracks a ftse website all day has suddenly popped up with an exception & exited somewhat ungraciously. This is the second time this has occured (512KB Broadb

[Tutor] simple list query

2005-01-02 Thread Dave S
OK simple query, I have a list consisting of about 250 items, I need to know if a particular item is in the list. I know this is better suited to a dictionary but thats not the way it ended up ;-) I could do a for loop to scan the list & compare each one, but I have a suspission that there is

Re: [Tutor] simple list query

2005-01-02 Thread Dave S
Patrick Hall wrote: Hi Dave, I have a list consisting of about 250 items, I need to know if a particular item is in the list. I know this is better suited to a dictionary but thats not the way it ended up ;-) I could do a for loop to scan the list & compare each one, but I have a suspis

[Tutor] Am I storeing up problems ?

2005-01-02 Thread Dave S
Hi there again, My matrix 'self.data' consists of a list of 110 items, each item is a dictionary of 250 keys, each key holds two lists, one of four items, one of 12 items. I needed to copy this matrix to 'self.old_data', so I have been using .deepcopy(), which works OK but is SLOW (12+ sec

Re: [Tutor] Am I storeing up problems ?

2005-01-03 Thread Dave S
Danny Yoo wrote: On Sun, 2 Jan 2005, Dave S wrote: My matrix 'self.data' consists of a list of 110 items, each item is a dictionary of 250 keys, each key holds two lists, one of four items, one of 12 items. Hi Dave, Hmmm... what kind of data is being copied here? Python's

Re: [Tutor] Am I storeing up problems ?

2005-01-03 Thread Dave S
Alan Gauld wrote: I needed to copy this matrix to 'self.old_data', so I have been using .deepcopy(), which works OK but is SLOW (12+ secs) Are you sure you need to copy it./ A simple reassignment should work and then reconstruct the structure using fresh lists/dictionary etc. That

[Tutor] 2d list matrix 7 x 75 problem

2005-03-06 Thread Dave S
Hello, I need to generate a list 2d matrix of the kind ... [['', '', '', '', ''], ['', '', '', '', ''], ['', '', '', '', ''], ['', '', '', '', ''], ['', '', '', '', '']] except its dimensions need to be 7 x 75. I thought I had it sorted with map2 = [ [''] *7 ] *75 until the coding screwed up & I

Re: [Tutor] 2d list matrix 7 x 75 problem

2005-03-06 Thread Dave S
Jeff Shannon wrote: On Sun, 06 Mar 2005 09:49:43 +, Dave S <[EMAIL PROTECTED]> wrote: I need to generate a list 2d matrix of the kind ... [['', '', '', '', ''], ['', '', '', '', ''], [&

[Tutor] Acessing files in Windows 2000

2005-03-08 Thread Dave S
I have a script that converts data relating to my work. It works great on my Linux system but some of my colleagues run windows. I am attempting to convert the file paths to windows but am having no luck. I need to access 'memo.txt' in 'my documents' on windows & am struggling. I have tried just

Re: [Tutor] Acessing files in Windows 2000

2005-03-08 Thread Dave S
John Purser wrote: Try c:\\my documents\\memo.txt John Unfortunately thats a no go ... palm.py palm memo.txt to oocalc data.csv convertor, written by lentil ;) [EMAIL PROTECTED] - enter "palm software" in the title or it will be junked 09-03-2005 v1.02w Coded for Windows 07-03-2005 v1.02 Cod

Re: [Tutor] Acessing files in Windows 2000

2005-03-09 Thread Dave S
Danny Yoo wrote: [Windows bashing cut] Python's support for Windows stuff is actually quite good, thanks to the work of Mark Hammond: http://starship.python.net/crew/mhammond/ A lot of us here do use Windows for COM programming. Let's get back to talking about Python programming and let's help

Re: [Tutor] Acessing files in Windows 2000

2005-03-09 Thread Dave S
[EMAIL PROTECTED] wrote: import os.path print os.path.expanduser('~/memo.txt') C:\Documents and Settings\Administrator/memo.txt f = open(os.path.expanduser('~/memo.txt')) Traceback (most recent call last): File "", line 1, in ? f = open(os.path.expanduser('~/memo.tx

[Tutor] Windows user variable ?

2005-06-26 Thread Dave S
Hi there, Probably no one will remember but I had a problem porting a python script to windows, I had a 'no such file error' Turned out that I called the file 'memo.txt', Windows decided it was a text file and it ended up as 'memo.txt.txt'. The windows display strips anything after the '.', found

Re: [Tutor] Windows user variable ?

2005-06-27 Thread Dave S
Thanks for your help guys Dave ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] OT python Licences

2005-07-12 Thread Dave S
This is a bit OT but here goes. My work wants me to write a fairly large python script to analyze some technical ASCII data files. Python and its libraries are GPL. That being the case am I right in thinking that my script would also have to be GPL and I would have to inform my employer as I hand

Re: [Tutor] OT python Licences

2005-07-12 Thread Dave S
Many thanks for all your input, you have been great. At the moment Tkinter is a favorite, I have started reading the documentation and it seems fairly straightforward + can do what I need. Many thanks once again :-) Dave ___ Tutor maillist - Tutor@py

[Tutor] Tkinter query?

2005-07-13 Thread Dave S
Hi all, Im on the Tkinter GUI learning curve :-) . Its going quite well - im reading O'reilly 'programming python' but I am unclear on the following I understand the standard form ie ... root = Tk() test = button(root, text = ..).pack() etc I also understand independant_win = Topl

Re: [Tutor] Tkinter query?

2005-07-13 Thread Dave S
Dave S wrote: >Hi all, > >Im on the Tkinter GUI learning curve :-) . Its going quite well - im >reading O'reilly 'programming python' but I am unclear on the following > >I understand the standard form ie ... > >root = Tk() >test = button(root, text = ..

Re: [Tutor] Tkinter query?

2005-07-13 Thread Dave S
Kent Johnson wrote: >Dave S wrote: > > >>>But I do not understand where Frame fits in to this ... ie >>> >>> >>> >>>from Tkinter import * >> >> >> >>>class Hello(Frame): >>> >

Re: [Tutor] Tkinter query?

2005-07-14 Thread Dave S
> > Frames are used to help with positioning other widgets, yes. They are > also used > to affect how the application looks: you can change the background > colour of > Frames, and also the border (to make them look like they are sticking > out, for > example). But you can (and frequently will) pu

[Tutor] smtplib mail header problem

2005-12-06 Thread dave s
Hi all, I have a python script that works out & emails my employer with parts that I have used. It has been great for 11ish months, now all my mail is classed as spam & junked :( Apparently the reason for it being junked is ... 'No subject' and 'No Sender' I set up a small test script to isol

Re: [Tutor] smtplib mail header problem

2005-12-06 Thread dave s
On Tuesday 06 December 2005 21:13, Liam Clarke-Hutchinson wrote: > Hi Dave, > > IIRC The first argument to sendmail() is the name of the account that's > sending... So when you include your subject there, it seems your ISP is > somewhat forgiving. > > Liam Clarke-Hutchinson| Contact Centre Advisor|

Re: [Tutor] smtplib mail header problem

2005-12-07 Thread dave s
On Tuesday 06 December 2005 22:23, Liam Clarke-Hutchinson wrote: > Okay, just checked the docs - > > "sendmail( from_addr, to_addrs, msg[, mail_options, rcpt_options]) > > Note: The from_addr and to_addrs parameters are used to construct the > message envelope used by the transport agents. The SMTP

Re: [Tutor] smtplib mail header problem

2005-12-10 Thread dave s
On Wednesday 07 December 2005 22:47, Liam Clarke-Hutchinson wrote: > Heheh, yah, the Python docs take a bit of scrutinisation to yield fruit. > Also, when working with emails, you'll probably end up trying to figure > what exactly what a RFC or three mean. > > Good luck, > > Liam > But its all wor

[Tutor] Looking for an open source project

2006-04-13 Thread Dave S
Hi all, I have been playing around with Python for a while now and am looking for open source KDE projects written in Python that I can help with / learn from. Something relatively simple that uses Qt. (I am still a bit green) Any idea where I can get a list of projects. I checked out sourcefo

Re: [Tutor] Looking for an open source project

2006-04-14 Thread Dave S
On Friday 14 April 2006 11:07, Kent Johnson wrote: > Dave S wrote: > > Hi all, > > > > I have been playing around with Python for a while now and am looking > > for open source KDE projects written in Python that I can help with / > > learn from. > > >

[Tutor] can't import module

2006-07-02 Thread Dave S
Hi all, I wrote some script a while back but can no longer get it to run, since then I have upgraded my system from breezy to dapper (kubuntu) I now cannot import a module I wrote. I just know its got to be simple and am somewhat embarrassed that I cannot see the problem :( [EMAIL PROTECTED]:~

Re: [Tutor] can't import module

2006-07-02 Thread Dave S
On Sunday 02 July 2006 11:29, Kent Johnson wrote: > Dave S wrote: > > > [EMAIL PROTECTED]:~/my_files/my_gg/gg1.4/get_data$ ./live_datad.py > > > > Traceback (most recent call last): > > File "./live_datad.py", line 15, in ? > > from logger impo

Re: [Tutor] can't import module

2006-07-02 Thread Dave S
On Sunday 02 July 2006 17:02, Dave Kuhlman wrote: > On Sun, Jul 02, 2006 at 11:55:24AM +0100, Dave S wrote: > > [snip] > > > Thanks for replying :) > > > > The app is fairly big and distributed around the gg1.4 directory. I get > > the feeling that 'from lo

Re: [Tutor] can't import module

2006-07-02 Thread Dave S
Here goes ... I have two files test1 and test2 ... [EMAIL PROTECTED]:~$ ls -l total 37620 drwx-- 8 dave dave 4096 2006-06-30 23:26 Desktop drwxr-xr-x 9 dave dave 4096 2006-06-15 22:48 google-earth drwxr-xr-x 13 dave dave 4096 2006-05-27 09:51 my_files drwxr-xr-x 2 dave dave

Re: [Tutor] can't import module

2006-07-02 Thread Dave S
On Sunday 02 July 2006 20:12, Alan Gauld wrote: > > As far a putting everything into a package - I am a bit lost. Do you > > mean one > > big .py script or am I misunderstanding you ? > > You misunderstand him. > > Python allows you to reate a package structure of directories and > files > such th

Re: [Tutor] SOLVED :)

2006-07-02 Thread Dave S
On Sunday 02 July 2006 18:32, Danny Yoo wrote: > > PYTHONPATH=/home/dave/my_files/my_gg/gg1.4/configs:/home/dave/my_files/my > >_gg/gg1.4/logs:/home/dave/my_files/my_gg/gg1.4/get_data:/home/dave/my_file > >s/my_gg/gg1.4/gg_utils:/home/dave/my_files/my_gg/gg1.4/ipc:/home/dave/my_f > >iles/my_gg/gg1.

Re: [Tutor] can't import module

2006-07-02 Thread Dave S
On Sunday 02 July 2006 18:48, Dave Kuhlman wrote: > On Sun, Jul 02, 2006 at 10:32:51AM -0700, Danny Yoo wrote: > > > PYTHONPATH=/home/dave/my_files/my_gg/gg1.4/configs:/home/dave/my_files/ > > >my_gg/gg1.4/logs:/home/dave/my_files/my_gg/gg1.4/get_data:/home/dave/my_ > > >files/my_gg/gg1.4/gg_utils:

[Tutor] Basic QT query

2006-07-14 Thread Dave S
Hi all, I am trying to get to grips with QT, putting a friendly face on some of my apps :) Its early days and my first attempt but I expected the following to print 'hi it works' every second. There problem I am stuck with is ... The debugged program raised the exception unhandled RuntimeErro

Re: [Tutor] Basic QT query #2

2006-07-14 Thread Dave S
On Friday 14 July 2006 19:21, Dave S wrote: > Hi all, > > I am trying to get to grips with QT, putting a friendly face on some of my > apps :) Its early days and my first attempt but I expected the following to > print 'hi it works' every second. > > There problem

Re: [Tutor] [SOLVED] Basic QT query #2

2006-07-15 Thread Dave S
On Friday 14 July 2006 23:21, Dave S wrote: > On Friday 14 July 2006 19:21, Dave S wrote: > > Hi all, > > > > I am trying to get to grips with QT, putting a friendly face on some of > > my apps :) Its early days and my first attempt but I expected the > > follo

[Tutor] open(file, 'rw') problem

2006-07-26 Thread Dave S
Good morning, I am having a problem with file open, read & write. The example shows my problem. I would have expected it to print a sequence 1,2,3,4 incrementing every time it is run. #!/usr/bin/env python import os, shutil, time basher_dir = '/home/dave/PodCasts' bit_bucket = basher_dir + '

Re: [Tutor] open(file, 'rw') problem

2006-07-27 Thread Dave S
On Thursday 27 July 2006 09:08, Andre Engels wrote: > 2006/7/27, Dave S <[EMAIL PROTECTED]>: > > It appears to be a problem with me opening the file as 'rw' although I > > have googled and opening as 'rw' appears legal. Can you only open a file > >

[Tutor] creating a method name on the fly

2006-08-07 Thread dave s
I need to scan a long list of QT tickboxes in a dialog. I need to execute pseudo code something like ... list = ['error_button', 'print_button' ... etc ] for key in list: button= list[key] print button, self.butto

Re: [Tutor] creating a method name on the fly

2006-08-07 Thread dave s
Thanks for all your input - the discussion wandered off list a bit ! This solution works a treat ... button= getattr(self, 'error_button') print button, button.isChecked() Cheers Dave ___ Tutor maillist - Tutor@python.org http://mail.python.org/mail

[Tutor] rstrip() failure ?

2006-08-09 Thread dave s
I have a string problem. The following code skips the loop if the string 'app' is on the banned list ... self.ban_app_list = [' ', 'live_dat', 'exact_sl', 'html_str', 'valid_da', 'datacore', 'check_co', 'logger'] if app in self.ban_app_list: continue the string 'app' is derived from s

Re: [Tutor] [Doh!] rstrip() failure ?

2006-08-09 Thread dave s
On Wednesday 09 August 2006 20:45, dave s wrote: > I have a string problem. The following code skips the loop if the string > 'app' is on the banned list ... > > self.ban_app_list = > [' ', 'live_dat', 'exact_sl', 'html_str

Re: [Tutor] rstrip() failure ?

2006-08-09 Thread dave s
On Wednesday 09 August 2006 21:11, you wrote: > > Is there a way to show the ascii values of the string - kind of hexedit > > for a string > > Try running repr() on the string: it will show an external > programmer-friendly representation that should be easier to read. For > example: > > #

[Tutor] Style query

2006-08-13 Thread dave s
As my programs become more complex I am aware of the need to adopt a consistent style. To differentiate between classes, instances & objects I use capital letters for example: A class uses 'MyClass' A class instance 'myInstance' A def uses 'myDef' An object 'myobject' or 'my_object' etc Can an

Re: [Tutor] Style query

2006-08-13 Thread dave s
On Sunday 13 August 2006 12:02, you wrote: > I believe you can find it here: > > http://www.python.org/doc/essays/styleguide.html > > Authored by Guido Van Rossum himself. > Thanks :) Dave > > Cheers, > > Richard > > On 8/13/06, dave s <[EMAIL PROTECTED]

[Tutor] A list in list problem

2006-08-21 Thread dave s
Help :) I have been playing with this for several hours & am totally stuck ! I am happy with the following ... >>> a=[1,2,3] >>> b=[5,6,7] >>> a [1, 2, 3] >>> b [5, 6, 7] >>> g=[] >>> g [] >>> g.append(a) >>> g [[1, 2, 3]] >>> g.append(b) >>> g [[1, 2, 3], [5, 6, 7]] >>> So when I needed to ma

Re: [Tutor] A list in list problem

2006-08-21 Thread Dave S
On Monday 21 August 2006 10:59, dave s wrote: Several hours +1 Sometimes it is usefull spelling out my problem in an email - seems to clarify it - maybe when I get to the 'im stuck' I should send an email to myself :) clean_csv.append(clean_line) ... should by clean_csv.append(

Re: [Tutor] A list in list problem

2006-08-21 Thread Dave S
On Monday 21 August 2006 13:40, Alan Gauld wrote: > > So when I needed to make a list of a list in the following code I > > thought no > > problem ... > > > > > > def CSV_Lines(self, csv, from_, to): > >"""Returns a list of cleaned up lines from csv 'from_' line > > number 'to' line numb

Re: [Tutor] A list in list problem

2006-08-21 Thread Dave S
On Monday 21 August 2006 13:58, János Juhász wrote: > Hi Dave, > > > From: dave s <[EMAIL PROTECTED]> > > Subject: [Tutor] A list in list problem > > To: python tutor > > Message-ID: <[EMAIL PROTECTED]> > > Content-Type: text/plain; charset="

Re: [Tutor] A list in list problem

2006-08-21 Thread Dave S
On Monday 21 August 2006 17:41, Alan Gauld wrote: > a=b=[] > a > > > > [] > > > b > > > > [] > > These are the same list. > > a=[1,2,3] > > But here you create a new list and assign it to a. > > a > > > > [1, 2, 3] > > > b > > > > [] > > So a points to the new list and

[Tutor] Larger GUI design ?

2006-08-22 Thread Dave S
I have managed to write a small GUI app, it had a frm_app.py from eric3s QT designer & a dlg_app.py which defined a class that inherited the frm_app.py class ... all AOK I am now on a more ambitious project. There will be a main app screen, some dialogue screens for more info etc and a backend

Re: [Tutor] Larger GUI design ?

2006-08-22 Thread Dave S
On Tuesday 22 August 2006 17:15, Alan Gauld wrote: > > I am now on a more ambitious project. There will be a main app > > screen, some > > dialogue screens for more info etc and a backend script analysing a > > database > > which will take some time to run. > > > > How to fit the GUI around it ? >

[Tutor] Package problem

2006-08-27 Thread Dave S
I am having a problem with packaging. I have setup the PYTHONPATH to the core dir with __init__.py in the sub directories. It all worked as expected - then I hit a problem :( I have a module scanDBFs in dir main with a def of getDbfData The module I am executing is DocViewDoc in QT DocViewDoc c

[Tutor] exit app withour raise ?

2006-09-17 Thread Dave S
In the middle of an application, if someone presses the quit button I want to exit. At the moment i raise 'Quit button pressed' which works but spews a stack trace leading to the raise statement. Is there a neat way to just exit without a stack trace ? Dave

Re: [Tutor] exit app withour raise ?

2006-09-17 Thread Dave S
On Sunday 17 September 2006 17:54, Alan Gauld wrote: > > In the middle of an application, if someone presses the quit button > > I want to > > exit. At the moment i > > > > raise 'Quit button pressed' > > > > which works but spews a stack trace leading to the raise statement. > > Is there a > > nea

[Tutor] module file copy ?

2006-09-21 Thread Dave S
OK have I missed it - but which module is file copy in ? I looked all around OS but no luck - I can find rename(src, dst) but that's about it. Cheers Dave ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] module file copy ?

2006-09-22 Thread Dave S
On Thursday 21 September 2006 21:48, Mike Hansen wrote: > > -Original Message- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] On Behalf Of Dave S > > Sent: Thursday, September 21, 2006 2:41 PM > > To: Python Tutor > > Subject: [Tutor] module

[Tutor] file open (take 2)

2006-09-27 Thread Dave S
Hi, I am trying to read in an ascii text file, do some alterations and write it back. file = open(self.config.get('pdf','cert') + '/cert.pdf' , 'r+') lines = file.readlines() ... process lines ... file.writelines(lines) file.close() works but ends up appending a second modified copy to the or

Re: [Tutor] file open (take 2)

2006-09-28 Thread Dave S
On Wednesday 27 September 2006 21:59, Dave S wrote: > Hi, > > I am trying to read in an ascii text file, do some alterations and write it > back. > > file = open(self.config.get('pdf','cert') + '/cert.pdf' , 'r+') > lines = file.re

[Tutor] getting 'pwd' for XP ?

2006-09-28 Thread Dave S
I currently running XP (like a fish out of water :) and I need to know the dir that the python script is executed from. a linux 'pwd' How can I achieve this - I have looked in sys & os & os.path but found nothing suitable Dave ___ Tutor maillist - Tu

Re: [Tutor] getting 'pwd' for XP ?

2006-09-28 Thread Dave S
On Thursday 28 September 2006 16:42, Shantanoo Mahajan wrote: > +++ Dave S [28-09-06 16:10 +0100]: > | I currently running XP (like a fish out of water :) and I need to know > | the dir that the python script is executed from. a linux 'pwd' How can I > | achieve this - I h

Re: [Tutor] free IDE for Python?

2006-11-16 Thread Dave S
On Monday 13 November 2006 23:03, Vadhri, Srinivas wrote: > Hi > > > > A newbie to Python. What is the free IDE for Python development > activities? ActiveState's Komodo IDE needs a license and a fee. > > > > Any recommendations? Eric3/4 works for me :) http://www.die-offenbachs.de/detlev/eric3-s

[Tutor] .sort(key = ???)

2006-11-16 Thread Dave S
Hi, I have a bunch of lists within lists that I need to sort ref item [4], I can't access my code at the moment but I basically ... a = [[...], [...], ] a.sort(item4) def item4(a,b): return a[4], b[4] Having googled I think there is a better way of doing this with the key attrib

Re: [Tutor] .sort(key = ???)

2006-11-16 Thread Dave S
On Thursday 16 November 2006 22:35, John Fouhy wrote: > On 17/11/06, Dave S <[EMAIL PROTECTED]> wrote: > > Hi, > > > > I have a bunch of lists within lists that I need to sort ref item [4], I > > can't access my code at the moment but I basically ... > >

[Tutor] exception not raised XP file ?

2006-11-18 Thread Dave S
Due to some sloppy programming on a commercial app :) I have a problem. I have some directories on an XP machine, I need to know which of these directories (*.cab_tmp) contains a file that that is being accessed by another XP program. I set it up so that a known file (SIZES.DBF) in a known dir

Re: [Tutor] exception not raised XP file ?

2006-11-18 Thread Dave S
On Saturday 18 November 2006 16:08, Roel Schroeven wrote: > Dave S schreef: > > Due to some sloppy programming on a commercial app :) I have a problem. > > > > I have some directories on an XP machine, I need to know which of these > > directories (*.cab_tmp) contain

[Tutor] finding AcroRd32.exe - a better way ?

2006-11-30 Thread Dave S
My app generates an on the fly PDF manual by using reportlab, once generated I would like it to be automatically opened and displayed by XP adobe reader. Here's where I get stuck. ... os.execv('E:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe', ('/n', '/s', 'user.pdf')) Does what I need

Re: [Tutor] finding AcroRd32.exe - a better way ?

2006-11-30 Thread Dave S
On Thursday 30 November 2006 20:50, Terry Carroll wrote: > On Thu, 30 Nov 2006, Dave S wrote: > > My app generates an on the fly PDF manual by using reportlab, once > > generated I would like it to be automatically opened and displayed by XP > > adobe reader. > > &

[Tutor] XP & catching execl o/p ?

2006-12-05 Thread Dave S
Hi all, Struggling with python & XP again. My app needs to know if a certain program is running on my XP box Ideal world - I can get the output of 'tasklist.exe' into a string. I have tried os.execl('') It throws the output to the terminal + I need the exact path to the executable (a bit

Re: [Tutor] XP & catching execl o/p ?

2006-12-05 Thread Dave S
On Tuesday 05 December 2006 20:58, Luke Paireepinart wrote: > Dave S wrote: > > Hi all, > > > > Struggling with python & XP again. My app needs to know if a certain > > program is running on my XP box > > > > Ideal world - I can get the output of 't

Re: [Tutor] XP & catching execl o/p ?

2006-12-05 Thread Dave S
On Tuesday 05 December 2006 22:42, Luke Paireepinart wrote: > Dave S wrote: > > On Tuesday 05 December 2006 20:58, Luke Paireepinart wrote: > >> Dave S wrote: > >>> Hi all, > >>> > >>> Struggling with python & XP again. My app needs

Re: [Tutor] XP & catching execl o/p ?

2006-12-05 Thread Dave S
On Tuesday 05 December 2006 23:32, Alan Gauld wrote: > "Dave S" <[EMAIL PROTECTED]> wrote > > > Struggling with python & XP again. My app needs to know if a certain > > program > > is running on my XP box > > > > os.execl('') &

Re: [Tutor] XP & catching execl o/p ?

2006-12-06 Thread Dave S
On Tuesday 05 December 2006 23:32, Alan Gauld wrote: > "Dave S" <[EMAIL PROTECTED]> wrote > > > Struggling with python & XP again. My app needs to know if a certain > > program > > is running on my XP box > > > > os.execl('') &

Re: [Tutor] XP & catching execl o/p ?

2006-12-06 Thread Dave S
On Wednesday 06 December 2006 08:48, Tim Golden wrote: > | Struggling with python & XP again. My app needs to know if a > | certain program is running on my XP box > > As a complete alternative, consider using WMI: > > > import os, sys > import wmi > > c = wmi.WMI () > for process in c.Win32_Proce

Re: [Tutor] XP & catching execl o/p ?

2006-12-06 Thread Dave S
On Wednesday 06 December 2006 11:04, Kent Johnson wrote: > Dave S wrote: > > Hi all, > > > > Struggling with python & XP again. My app needs to know if a certain > > program is running on my XP box > > > > Ideal world - I can get the output of 't

Re: [Tutor] XP & catching execl o/p ?

2006-12-06 Thread Dave S
On Wednesday 06 December 2006 11:43, Dave S wrote: > On Tuesday 05 December 2006 23:32, Alan Gauld wrote: > > "Dave S" <[EMAIL PROTECTED]> wrote > > > > > Struggling with python & XP again. My app needs to know if a certain > > > progr

[Tutor] subprocess & pyw conflict ?

2006-12-06 Thread Dave S
Hi all, I thought I had my solution with subprocess ... my test code ... #!/usr/bin/env python # -*- coding: iso8859_1 -*- import subprocess a = subprocess.Popen('tasklist.exe', bufsize=0, stdout=subprocess.PIPE, universal_newlines=True) op = a.stdout.readlines() for i in op: i

Re: [Tutor] subprocess & pyw conflict ?

2006-12-07 Thread Dave S
On Thursday 07 December 2006 00:31, Luke Paireepinart wrote: > Dave S wrote: > > Hi all, > > > > I thought I had my solution with subprocess ... my test code ... > > > > > > > > #!/usr/bin/env python > > # -*- coding: iso8859_1 -*- >

Re: [Tutor] subprocess & pyw conflict ?

2006-12-07 Thread Dave S
On Thursday 07 December 2006 10:25, Dave S wrote: > On Thursday 07 December 2006 00:31, Luke Paireepinart wrote: > > Dave S wrote: > > > Hi all, > > > > > > I thought I had my solution with subprocess ... my test code ... > > > > > > > >

[Tutor] OT GPL project finished, presentation looming

2006-12-07 Thread Dave S
OK this is an OT question I have just finished a Python QT project for work, written in my own free time over the last several months (and with a lot of help from you guys :). Its 5500 lines of python over several modules (for me that huge) and a CSV 'rules' file of 500 lines, all GPL'd We us

Re: [Tutor] OT GPL project finished, presentation looming

2006-12-07 Thread Dave S
On Thursday 07 December 2006 17:54, Luke Paireepinart wrote: > Dave S wrote: > > [snip explanation of program] > > Sounds really cool! Its a bit niche - but cool > > > Sometime in January I have to give a presentation and I know one of the > > questions will be. &qu

Re: [Tutor] OT GPL project finished, presentation looming

2006-12-08 Thread Dave S
On Thursday 07 December 2006 22:35, Alan Gauld wrote: > "Dave S" <[EMAIL PROTECTED]> wrote > > > They will be concerned about using my app because I am one person. > > What if I > > get hit by a bus ! what if I leave ? > > This is a common problem

  1   2   >