Re: [Tutor] sets module equivalent with Python 2.6

2009-04-10 Thread bob gailer
PyProg PyProg wrote: Hello all, I want to use an equivalent of sets module with Python 2.6 ... but sets module is deprecated on 2.6 version. set is now a built-in type. Replace sets.Set() with set() In fact I want to make that but with Python 2.6: toto_1 = [0, 1, 2, 3, 4] toto_2 = [1

[Tutor] Yet another Python book

2009-04-10 Thread Dave Kuhlman
I've collected my training materials plus a few more advanced topics and I've also written up a reasonably large set of Python exercises. Then, I turned all of the above into a "book". If you have comments, suggestions, corrections, etc, I'll appreciate them. You can get it at no cost, in variou

Re: [Tutor] Problem with converting Python to EXE using py2exe

2009-04-10 Thread Alan Gauld
"Chris Lee" wrote _tkinter.TclError: Couldn't open "base.gif": no such file or directory ... I linked an image to the python file, but the exe can't find it.. (right?) Correct > base = pic(file="base.gif") Now, I'm just wondering... for the "base.gif" part, would it be better to write

Re: [Tutor] OOP / Classes questions

2009-04-10 Thread Alan Gauld
"Stefan Lesicnik" wrote I am a relative newbie to python and OOP concepts and am trying to work through wxpython. I've seen understanding classes is essential to this and have been trying to work through them. Steve gave you the basic explanation, I'll try a slightly different tack - which ma

Re: [Tutor] OOP / Classes questions

2009-04-10 Thread Alan Gauld
"Skipper Seabold" wrote tutorial or documentation re OOP and classes? I've found Alan Gauld's tutorials to be very useful when just getting started in both OOP and Python. http://www.freenetpages.co.uk/hp/alan.gauld/ Thanks for the plug :-) However the URL has changed since freenetpages

[Tutor] Problem with converting Python to EXE using py2exe

2009-04-10 Thread Chris Lee
Hi tutors, So I finally made my program. When I run it with python, it works perfectly! But when I convert it to an executable using py2exe (correctly), I get an error: Traceback (most recent call last): File "oentry.py", line 52, in File "Tkinter.pyc", line 3270, in __init__

Re: [Tutor] Make beautifulsoup show the data it has an issue with

2009-04-10 Thread Kent Johnson
On Fri, Apr 10, 2009 at 5:08 PM, Sander Sweers wrote: > Hello Tutors, > > I am having some issues with a malformed tag in a html page. > BeautifulSoup barfs with the following. > > raceback (most recent call last): >  File "C:\Python25\lib\HTMLParser.py", line 115, in error >    raise HTMLParseEr

[Tutor] Make beautifulsoup show the data it has an issue with

2009-04-10 Thread Sander Sweers
Hello Tutors, I am having some issues with a malformed tag in a html page. BeautifulSoup barfs with the following. raceback (most recent call last): File "", line 1, in tsoup = BeautifulSoup(readPage('http://url.sanitized')) File "C:\Python25\lib\site-packages\BeautifulSoup.py", line 149

Re: [Tutor] OOP / Classes questions

2009-04-10 Thread Steve Willoughby
On Fri, Apr 10, 2009 at 08:44:37PM +0200, Stefan Lesicnik wrote: > I am a relative newbie to python and OOP concepts and am trying to > work through wxpython. I've seen understanding classes is essential to > this and have been trying to work through them. Welcome! If you're really new, wxpython

Re: [Tutor] OOP / Classes questions

2009-04-10 Thread Skipper Seabold
On Fri, Apr 10, 2009 at 2:44 PM, Stefan Lesicnik wrote: > I guess as a general kind of question, can anyone recommend some > tutorial or documentation re OOP and classes? I've found Alan Gauld's tutorials to be very useful when just getting started in both OOP and Python. http://www.freenetpages

[Tutor] OOP / Classes questions

2009-04-10 Thread Stefan Lesicnik
Hi guys, I am a relative newbie to python and OOP concepts and am trying to work through wxpython. I've seen understanding classes is essential to this and have been trying to work through them. I have a few questions re the below code (i suspect its due to a lack of my understanding of classes)

Re: [Tutor] ideas on how to process a file

2009-04-10 Thread Weidner, Ronald
In my last e-mail I think I suggested making an Item object. This time I'll suggest an ItemCollection object. Now you can have an Add(self, item) that could validate. This could be some rather simple loop and test logic. -- Ronald Weidner From: tutor-bounces+rweidner=ea@python.org [mai

Re: [Tutor] how to make classes play well together

2009-04-10 Thread Kent Johnson
On Fri, Apr 10, 2009 at 12:34 PM, C or L Smith wrote: > Unum is a module that allows one to handle units with numbers, e.g. 3*M -> 3 > [m], a measurement of 3 meters. > > I have a module that I wrote some time ago that handles uncertainties with > numbers as they are involved with calculations.

Re: [Tutor] ideas on how to process a file

2009-04-10 Thread Kent Johnson
On Fri, Apr 10, 2009 at 1:12 PM, Sander Sweers wrote: > results = [] > > for line in text_file: >    if 'FULLNAME' in line and line not in results: >        results.append(line) >        write_file.write(line) In general it is better to use a set for this kind of application, it will have much be

Re: [Tutor] ideas on how to process a file

2009-04-10 Thread Sander Sweers
2009/4/10 Spencer Parker : > The question is now...what do I do to find duplicate entries in the text > file I am reading.  I just want to filter them out.  There are a ton of > duplicate entries in there. >>> for line in text_file: # No need for readlines(), a file is iterable >>>  if 'FULLNAME

Re: [Tutor] ideas on how to process a file

2009-04-10 Thread Spencer Parker
The question is now...what do I do to find duplicate entries in the text file I am reading. I just want to filter them out. There are a ton of duplicate entries in there. On Fri, Apr 10, 2009 at 10:43 AM, Spencer Parker wrote: > Oh...nice...this makes things much easier than what I had before.

[Tutor] how to make classes play well together

2009-04-10 Thread C or L Smith
Unum is a module that allows one to handle units with numbers, e.g. 3*M -> 3 [m], a measurement of 3 meters. I have a module that I wrote some time ago that handles uncertainties with numbers as they are involved with calculations. Let's call it the pnum module (for physical numbers) e.g. pnum(

Re: [Tutor] trouble understanding the difference

2009-04-10 Thread johnf
On Friday 10 April 2009 09:41:13 am johnf wrote: > On Friday 10 April 2009 08:35:13 am johnf wrote: > > I can get the following to work: > > os.system('lp -d printer invoice.pdf') > > > > but what I think is the correct way for the future is: > > subprocess.Popen('lp -d printer invoice.pdf') > > an

Re: [Tutor] ideas on how to process a file

2009-04-10 Thread Spencer Parker
Oh...nice...this makes things much easier than what I had before. I mainly used writelines because I couldn't figure out why it was only writing one line. Then I did and never took out the writelines...I just did and it works just fine for the most part. Thanks again for the help. On Fri, Apr 1

Re: [Tutor] trouble understanding the difference

2009-04-10 Thread johnf
On Friday 10 April 2009 08:35:13 am johnf wrote: > I can get the following to work: > os.system('lp -d printer invoice.pdf') > > but what I think is the correct way for the future is: > subprocess.Popen('lp -d printer invoice.pdf') > and it does not work??? > > Can someone explain what I'm doing wr

[Tutor] trouble understanding the difference

2009-04-10 Thread johnf
I can get the following to work: os.system('lp -d printer invoice.pdf') but what I think is the correct way for the future is: subprocess.Popen('lp -d printer invoice.pdf') and it does not work??? Can someone explain what I'm doing wrong? Traceback (most recent call last): File "/home/johnf/

Re: [Tutor] ideas on how to process a file

2009-04-10 Thread Kent Johnson
On Fri, Apr 10, 2009 at 12:04 PM, Spencer Parker wrote: > > This is my code: > http://pastebin.com/m11053edf I guess you have something like this now: for line in text_file.readlines(): if line.find('FULLNAME')>=0: write_file.writelines(line) This can be better written a

Re: [Tutor] ideas on how to process a file

2009-04-10 Thread Spencer Parker
I forgot to respond back to the list: The only info I really need is the name. So I have been using readlines() to go through and find the lines that have fullname, if line.find("FULLNAME")>=0: I am now having issues with it writing it to a file. This is my code: http://pastebin.com/m11053edf

[Tutor] Reading a file and best approach for it...

2009-04-10 Thread Spencer Parker
I have a flat file database that I want to get information from. The basic text looks like this: ITEM{ "FULLNAME" "apps114.chgit.com!file:/etc" "RECOVERY" "0" } They are all on a separate line in the text file. I had thought about trying to drop it into a list or a

Re: [Tutor] ideas on how to process a file

2009-04-10 Thread Alan Gauld
"Spencer Parker" wrote in message I have a flat file database that I want to get information from. The basic text looks like this: ITEM{ "FULLNAME" "apps114.chgit.com!file:/etc" "RECOVERY" "0" } They are all on a separate line in the text file. I had thought ab

[Tutor] ideas on how to process a file

2009-04-10 Thread Spencer Parker
I have a flat file database that I want to get information from. The basic text looks like this: ITEM{ "FULLNAME" "apps114.chgit.com!file:/etc" "RECOVERY" "0" } They are all on a separate line in the text file. I had thought about trying to drop it into a list or a

Re: [Tutor] What is Dani Web?

2009-04-10 Thread Wayne Watson
Title: Signature.html Thanks. Interesting. BTW, the short one didn't work, but the long one did. It's always a good idea to put <> around a url. It keeps the url on one line. Ken Oliver wrote: Try this: http://www.ask.com/bar?q=what+is+daniweb&page=1&qsrc=121&ab=0&u=http%3A%2F%2F

Re: [Tutor] How to write server which listens to specific port

2009-04-10 Thread Kent Johnson
On Fri, Apr 10, 2009 at 4:59 AM, ShivKumar Anand wrote: > I have to implement HL7 in my existing application. > so, I have to send/receive messages which are in a text file (not > implementing v3.0, in which the messages are in xml format) Googling "python hl7" finds a couple of hints for the se

Re: [Tutor] How to write server which listens to specific port

2009-04-10 Thread ShivKumar Anand
Thanks Alan for reply. I have to implement HL7 in my existing application. so, I have to send/receive messages which are in a text file (not implementing v3.0, in which the messages are in xml format) I found tutorial on socket programming and trying from that. By importing socket.

Re: [Tutor] How to write server which listens to specific port

2009-04-10 Thread Alan Gauld
"ShivKumar Anand" wrote I have developed an application in Python 2.4.2, TurboGears 1.0, cherryPy 2.3.1. Well done. Now, I have to develop a server, which listens to a specific port (104) and save the file to a specific location (/tmp/myDir) on RHEL 4/5. Does this server have anything to

Re: [Tutor] What is Dani Web?

2009-04-10 Thread Ken Oliver
Title: Signature.html Try this:http://www.ask.com/bar?q=what+is+daniweb&page=1&qsrc=121&ab=0&u=http%3A%2F%2Fwww.daniweb.com%2Fforums%2Ffaq.php%3Ffaq%3Ddaniweb_faqor shorterhttp://tinyurl.com/cfsvpa-Original Message- From: Wayne Watson Sent: Apr 9, 2009 11:52 PM To: "tutor@python.org" Subj