Re: [Tutor] An idea for a script

2007-10-10 Thread Dick Moores
I think I've done it, and with only the initial help from Ian. (The output is pasted at the bottom of the script.) Now I have to consider carefully all the ideas and suggestions offered, and also the undoubtedly forthcoming criticism. Thank you

Re: [Tutor] os.rename anomaly in Python 2.3 on Windows XP

2007-10-10 Thread Terry Carroll
On Tue, 9 Oct 2007, Tony Cappellini wrote: > Unfortunately,os.listdir() returns the same string as glob.glob, for > the problem file I mentioned. Tony -- Try specifying the argument to os.listdir as a unicode string. I've found that cures many ailments like this. e.g., instead of something lik

Re: [Tutor] An idea for a script

2007-10-10 Thread Ian Witham
On 10/11/07, Dick Moores <[EMAIL PROTECTED]> wrote: > > At 04:20 PM 10/10/2007, Dick Moores wrote: > >How about a hint of how to get those ">jcooley<" things from the > >source? (I'm able to have the script get the source, using urllib2.) > > > >BTW I thought I wouldn't try to use BeautifulSoup rig

Re: [Tutor] An idea for a script

2007-10-10 Thread Kent Johnson
Dick Moores wrote: > How about a hint of how to get those ">jcooley<" things from the source? > (I'm able to have the script get the source, using urllib2.) > > BTW I thought I wouldn't try to use BeautifulSoup right now, but take > the hard way. Well, you could probably do it with regular expr

Re: [Tutor] An idea for a script

2007-10-10 Thread Dick Moores
At 04:20 PM 10/10/2007, Dick Moores wrote: >How about a hint of how to get those ">jcooley<" things from the >source? (I'm able to have the script get the source, using urllib2.) > >BTW I thought I wouldn't try to use BeautifulSoup right now, but >take the hard way. > >Dick I asked for a hint to

Re: [Tutor] An idea for a script

2007-10-10 Thread Ian Witham
On 10/11/07, Dick Moores <[EMAIL PROTECTED]> wrote: > > At 02:06 PM 10/10/2007, Ian Witham wrote: > > > On 10/11/07, *Dick Moores* <[EMAIL PROTECTED]> wrote: > I think I could learn a lot about the use of Python with the web by > writing a script that would look at > < http://starship.python.net/

Re: [Tutor] An idea for a script

2007-10-10 Thread Dick Moores
At 02:06 PM 10/10/2007, Ian Witham wrote: On 10/11/07, Dick Moores <[EMAIL PROTECTED]> wrote: I think I could learn a lot about the use of Python with the web by writing a script that would look at < http://starship.python.net/crew/index.html> and find all the links to more that just the d

[Tutor] internet access

2007-10-10 Thread Kirk Vander Meulen
Hi, I'd like to write a script that limits internet access to certain hours of the day. This seems like it should be simple but I'm not very experienced with any programming that involves networking. Can someone point me in the right direction on this- I'm sure I can figure out how to use a calen

Re: [Tutor] Re-Naming an existent file

2007-10-10 Thread Bill Campbell
On Wed, Oct 10, 2007, Ed Goulart wrote: > > Hello! > > Though I've tried very hard, I couldn't find in the WEB the needed > help; so, if you can help me, please...!!! import os os.rename(old, new) Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC URL: http://www.c

Re: [Tutor] Extract lines from a multinile string-Thanks

2007-10-10 Thread Kent Johnson
John Fouhy wrote: >> I found it somewhat annoying that in order to define a two-dimensional array >> in python I need some may [[[]]] and ,,: >> A = array([[0, 1, 2, 3], # initialize 2-d array >>[4, 5, 6, 7], >>[8, 9, 10, 11], >>[12, 13, 14, 15]]) I

[Tutor] Re-Naming an existent file

2007-10-10 Thread Ed Goulart
Hello! Though I've tried very hard, I couldn't find in the WEB the needed help; so, if you can help me, please...!!! *The problem is* that I need to rename a file (*qso.txt*) after a value input "*call*" I get in the first line (<*call value*>*.txt*)* *... I get the file qso.txt but I get no succe

Re: [Tutor] Extract lines from a multinile string-Thanks

2007-10-10 Thread John Fouhy
Hi Eli, Please use "reply to all" so that other list users can follow the conversation if they wish. On 11/10/2007, Eli Brosh <[EMAIL PROTECTED]> wrote: > Thank you very much for the reply. > No, I did not check that there is no control character in the multiline. > I just assumed that it is not

Re: [Tutor] An idea for a script

2007-10-10 Thread Eric Walstad
Dick Moores wrote: > I think I could learn a lot about the use of Python with the web by > writing a script that would look at > and find all the links > to more that just the default shown by this one: > . I

Re: [Tutor] An idea for a script

2007-10-10 Thread Ian Witham
On 10/11/07, Dick Moores <[EMAIL PROTECTED]> wrote: > > I think I could learn a lot about the use of Python with the web by > writing a script that would look at > and find all the links > to more that just the default shown by this one: >

[Tutor] An idea for a script

2007-10-10 Thread Dick Moores
I think I could learn a lot about the use of Python with the web by writing a script that would look at and find all the links to more that just the default shown by this one: . I think there should be about

Re: [Tutor] Updating MySQL Database

2007-10-10 Thread wormwood_3
I loved that strip so much. I printed it today, and it is on the door of our IT office:-) - Original Message From: Kent Johnson <[EMAIL PROTECTED]> To: Python Tutorlist Sent: Wednesday, October 10, 2007 8:52:12 AM Subject: Re: [Tutor] Updating MySQL Database Kent Johnson wrote: > It

Re: [Tutor] Updating MySQL Database

2007-10-10 Thread christopher . henk
That Slashdot comment makes so much more sense now. Chris Henk Allison Transmission phone: 317.242.2569 cell: 765.337.8769 fax: 317.242.3469 e-mail: [EMAIL PROTECTED] Kent Johnson <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 10/10/2007 08:52 AM To Python Tutorlist cc Subject Re: [Tutor

Re: [Tutor] Updating MySQL Database

2007-10-10 Thread Kent Johnson
Kent Johnson wrote: > It > also looks like you are embedding the data in the SQL command, this is > very bad practice, it opens you to SQL injection attacks For a humorous explanation of why you don't want to directly embed data into SQL commands, see today's xkcd: http://xkcd.com/327/ Kent _

Re: [Tutor] remmote access in a python program

2007-10-10 Thread Kent Johnson
Kirk Bailey wrote: > they are on the same LAN, and the files may be accessed via http. As in, directory listings rendered to HTML? Sounds like a job for urllib2 (in the standard lib) and BeautifulSoup. http://www.crummy.com/software/BeautifulSoup/ Kent PS Please use Reply All to reply on-list.

Re: [Tutor] remmote access in a python program

2007-10-10 Thread Kent Johnson
Kirk Bailey wrote: > OK, python program in box 1 needs to build a list of files available to be > examined in box 2 on the firms LAN- .xls spreadsheet files. Sounds like a > glob.glob task, but in a remote fashion. I never tried this before, what's > the smart answer? What kind of access does b

[Tutor] remmote access in a python program

2007-10-10 Thread Kirk Bailey
OK, python program in box 1 needs to build a list of files available to be examined in box 2 on the firms LAN- .xls spreadsheet files. Sounds like a glob.glob task, but in a remote fashion. I never tried this before, what's the smart answer? -- Salute! -Kirk Bailey Think

Re: [Tutor] Finding a project

2007-10-10 Thread Norman Khine
maybe you can contribute and help out on some open source projects. i know that the guys at http://ikaaro.org need help with testing. http://download.ikaaro.org/itools/itools-0.16.8.tar.gz or if you want the latest, you can check it out from: % git-clone http://lleu.org/itools.git Eric Lake wr

Re: [Tutor] Exceptions: Logging TB and local variables?

2007-10-10 Thread Kent Johnson
Allen Fowler wrote: > In the error log, I would like to record a stacktrace and various local > variables that existed in subX at the time the Exception was thrown... The stack trace is easy - add the parameter exc_info=True to the logging call, e.g. logging.error('Oops!', exc_info=True) Wh

Re: [Tutor] Fwd: Permission Report

2007-10-10 Thread Stephen Nelson-Smith
On 10/10/07, Kent Johnson <[EMAIL PROTECTED]> wrote: > Stephen Nelson-Smith wrote: > > But if I want to run the same procedure on a remote host, and store > > the results in a dictionary so they can be compared, what would I do? > > What kind of access do you have to the remote host? If you have >

Re: [Tutor] Exceptions: Logging TB and local variables?

2007-10-10 Thread Alan Gauld
"Kalle Svensson" <[EMAIL PROTECTED]> wrote >> but only if the data is in scope. If it is local data within the >> raising function then bit will be gone by the time you catch >> the exception. > > Well, not entirely. If you look at the sys.exc_info() function there > is a way to get the backtrace

Re: [Tutor] Exceptions: Logging TB and local variables?

2007-10-10 Thread Kalle Svensson
On 10/10/07, Alan Gauld <[EMAIL PROTECTED]> wrote: > > "Allen Fowler" <[EMAIL PROTECTED]> wrote > > > Now, I would like to do this: > > > > for item in bigset: > > try: > > self.__sub1(item) > > self.__sub2(item) > > self.__sub3(item) > > except StandardError: > > # Log error an

Re: [Tutor] Exceptions: Logging TB and local variables?

2007-10-10 Thread Alan Gauld
"Allen Fowler" <[EMAIL PROTECTED]> wrote > Now, I would like to do this: > > for item in bigset: > try: > self.__sub1(item) > self.__sub2(item) > self.__sub3(item) > except StandardError: > # Log error and continue to next item in set. > log_error_to_file() > >