[Tutor] How to programmatically EDIT a python file using an editor of my choice ?

2009-04-12 Thread Dominique
Hi, I'd like to edit and not run a .py file programmatically. os.path(filename.py) runs the file using python. What I'd like is to only edit the file using Idle or Notepad++ or Spe... I could do this by making a new file with a .txt extension. But in that case, it is the program associated with

Re: [Tutor] How to programmatically EDIT a python file using an editorof my choice ?

2009-04-12 Thread Alan Gauld
"Dominique" wrote What I'd like is to only edit the file using Idle or Notepad++ or Spe... What I'd like is to open the file using an editor of my choice. How would you do this non programatically and not from the GUI? In other words can you do it from an OS command line? If so put that com

Re: [Tutor] How to programmatically EDIT a python file using an editorof my choice ?

2009-04-12 Thread Alan Gauld
"Dominique" wrote I tried several other ways without any success: subprocess.Popen(args = ["notepad++.exe", filename]) subprocess.Popen(args = ["C:\Program Files\Notepad++\notepad++.exe", filename]) I wonder if it is due to the location of the softwares. In a way. I think it's because you

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

2009-04-12 Thread Kent Johnson
On Sun, Apr 12, 2009 at 10:21 AM, Sander Sweers wrote: > 2009/4/10 Kent Johnson : >> Or, catch >> the exception, have the code find out where the error is and display >> the bad line. > > This is what I was looking for. I know how to catch the exception but > how do I make it display the bad line?

Re: [Tutor] How to programmatically EDIT a python file using an editorof my choice ?

2009-04-12 Thread Sander Sweers
2009/4/12 Dominique : > I tried several other ways without any success: > subprocess.Popen(args = ["notepad++.exe", filename]) > subprocess.Popen(args = ["C:\Program Files\Notepad++\notepad++.exe", > filename]) Try this: subprocess.Popen(args = [r'C:\Program Files\Notepad++\notepad++.exe', filen

Re: [Tutor] How to programmatically EDIT a python file usin g an editorof my choice ?

2009-04-12 Thread Dominique
Alan Gauld btinternet.com> writes: > > How would you do this non programatically and not from the GUI? > In other words can you do it from an OS command line? Hello Alan, Thank you for your response. I want to do it from a GUI (with wxPython). I work with Windows XP SP3, python 2.5 and wxP

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

2009-04-12 Thread Sander Sweers
2009/4/10 Kent Johnson : > Or, catch > the exception, have the code find out where the error is and display > the bad line. This is what I was looking for. I know how to catch the exception but how do I make it display the bad line? Thanks Sander ___ Tu

Re: [Tutor] How to programmatically EDIT a python file usin g an editorof my choice ?

2009-04-12 Thread Dominique
OK. With r before the path of the software, it works perfectly. subprocess.Popen([r"C:\Program Files\Editra\Editra.exe", filename]) I saw that once but I don't remember and cannot find the reason for the use of r. I'll try not to forget to test with and without r in case a file access doesn't

Re: [Tutor] How to programmatically EDIT a python file using an editorof my choice ?

2009-04-12 Thread Sander Sweers
2009/4/12 Dominique : > With r before the path of the software, it works perfectly. > subprocess.Popen([r"C:\Program Files\Editra\Editra.exe", filename]) > I saw that once but I don't remember and cannot find the reason for the use > of r. The r means the string is a raw string. > I'll try not t

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

2009-04-12 Thread Sander Sweers
2009/4/12 Kent Johnson : > try: >  tsoup = BeautifulSoup(data) > except HTMLParseError, ex: Aah, ex is the object/class which has the error data. This was the missing piece for me. Many thanks Kent! Greets Sander ___ Tutor maillist - Tutor@python.org

[Tutor] Reading a "Raw "Image File

2009-04-12 Thread Wayne Watson
I can read a raw of 640x480 bytes with: raw_file=open('sent_internal.raw') raw_image=raw_file.read() It likely contains a lot of 0 values, black=0. The result above is a string of 242 characters. I'm guessing the 0's were ignored, and only >0 values were kept. If so, how do I get all 30720

Re: [Tutor] Reading a "Raw "Image File

2009-04-12 Thread Alan Gauld
"Wayne Watson" wrote raw_image=raw_file.read() One more question, when I tried (no 'wb') read(size=307200), why di read balk at size, syntactically. It doesn't balk at the size syntactically it finds what it thinks is an End Of file character code in the data and stops reading. Tha

Re: [Tutor] Reading a "Raw "Image File

2009-04-12 Thread Emile van Sebille
Wayne Watson wrote: I can read a raw of 640x480 bytes with: raw_file=open('sent_internal.raw') raw_file=open('sent_internal.raw','rb') raw_image=raw_file.read() It likely contains a lot of 0 values, black=0. The result above is a string of 242 characters. I'm guessing the 0's wer

Re: [Tutor] Reading a "Raw "Image File

2009-04-12 Thread Wayne Watson
I think I meant why didn't I find the value 150 (a high) in the the 242 if I had correctly guessed only 242 non-zero pixels were the cause of the shrinkage. Instead I found 31 as the high. It makes sense though if it shortened to the first CR found. The CR was probably at 243. Among the 3072

Re: [Tutor] Using Easygui in Python v3

2009-04-12 Thread Wayne Watson
Possibly contact Steve Ferg? Alan Gauld wrote: I'm currently updating my tutorial to cover Python V3. I thought it miight be good to include some stuff on EasyGUI for the user input topic and on checking the web site it said Easygui was compatible with Python v3. However after downloading and

[Tutor] Tkinter and Antialiasing

2009-04-12 Thread Wayne Watson
If I draw a fairly slanted line across an image using Tkinter, it looks a bit jagged. Is this typical of Tkinter graphics, or is there an option or mechanism that will antialias? Win XP, Python 2.5, Tkinter 8.4. -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

Re: [Tutor] Using Easygui in Python v3

2009-04-12 Thread Alan Gauld
"Wayne Watson" wrote Possibly contact Steve Ferg? Yes I did that and Steve has included my fix in the latest version. He also kindly gave a plug to my tutorial :-) I've now included a section on EasyGui in my "Talking to the User" topic in the Python v3 version. -- Alan G Author of the Le

Re: [Tutor] Tkinter and Antialiasing

2009-04-12 Thread Alan Gauld
"Wayne Watson" wrote If I draw a fairly slanted line across an image using Tkinter, it looks a bit jagged. Is this typical of Tkinter graphics, or is there an option or mechanism that will antialias? I think that is a feature of the canvas and its underlying code. I can't see any anti-alias

Re: [Tutor] Tkinter and Antialiasing

2009-04-12 Thread Wayne Watson
I can probably get around it in this case. What I was attempting to do is draw radial lines out from a center. Each maybe 15 degrees apart. Basically compass style. With the jaggies it looks a bit odd; however, I can probably do this with a graphics tool, and then superimpose it on the image I

[Tutor] Using numpy Array Capabilities

2009-04-12 Thread Wayne Watson
I'm pretty sure numpy can manipulate arrays, but I'm barely familiar with it. Basically, what I would like to do is to take a list like: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] and convert it to; [['0x0', '0x1', '0x2', '0x3', '0x4'], ['0x5', '0x6', '0x7', '0x8', '0x9']] That is, it becomes a matrix of

[Tutor] FW: another newbie

2009-04-12 Thread j mercedes
hi, its me again jay, thanks alot everyone for your input on the last program i created that solved for the mode,mean, and average of a set of numbers it actually worked great...i used the import in a bit different method but still very valuable...if anyone can give me any ideas on thi

[Tutor] get bytes back from string representation?

2009-04-12 Thread Daniel
hi list, I am using SUDS to talk with a web service written by C#. The service will crawl a web page, then return its content as bytes. it's something like: >>> from suds.client import Client >>> url = "http://WSServer/Service1.asmx?wsdl"; >>> client = Client(url) >>> page = client.service.GetUR

Re: [Tutor] How to programmatically EDIT a python file usin g an editorof my choice ?

2009-04-12 Thread Dominique
Sander Sweers gmail.com> writes: Hello Sander, > > The r means the string is a raw string. > > The real issue is what Alan pointed out. The backlash is an escape > character and if you want to use it in a string should be escaped by a > backlash.Using a raw string will give the same result as