[Tutor] Checking the desktop environment

2008-06-20 Thread Timo
Hello all, in my program I need to know what desktop environment the user is running. I figured this piece of code works, but apparently not on every Linux distro. On Ubuntu it did the trick, but then I heard of someone who runs SLiM that he get's an error with this. if os.environ['DESKTOP_SESSION

Re: [Tutor] Learning Python from books

2008-06-20 Thread Kent Johnson
On Thu, Jun 19, 2008 at 2:56 PM, Zameer Manji <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA512 > > Has anyone here attempted to learn Python from books ? I learned Python from Learning Python and Python Cookbook initially. Also lots of practice. Reading comp.lang.pyth

[Tutor] Using Regex from Configuration File

2008-06-20 Thread Tyler Rutschman
Hello everyone, I'm new to python and have set up a program to parse through reports. The script has started very basic and I've been folding in additional features as it moves along. What it does is takes a specified log file (exported from splunk) and parses through it with a regex specific to t

Re: [Tutor] Using Regex from Configuration File

2008-06-20 Thread Kent Johnson
On Fri, Jun 20, 2008 at 10:04 AM, Tyler Rutschman <[EMAIL PROTECTED]> wrote: > I've successfully set up ConfigParser to go through the config and apply the > proper configuration to the script, but I'm having trouble getting the regex > to work. It worked successfully when I declared it within the

[Tutor] Help! Character conversion from a rtf file.

2008-06-20 Thread Chien Nguyen
Hi All, I am a newbie to Python. I just did some readings on the web and got some basic understanding about the language. I'd like to learn the language by writing some simple programs rather than keep reading books. My first program will convert certain uni-code characters (let's say UTF-8) in an

[Tutor] How to set up dispatch function

2008-06-20 Thread Tyler Rutschman
Hello again everyone, I'm trying to add another fold into my log reporting script. I would like to set up a dispatch function to find the proper report format for the indicated configuration. The function would need to recognize the configuration and call a function that will parse the data and ge

Re: [Tutor] Checking the desktop environment

2008-06-20 Thread Alan Gauld
"Timo" <[EMAIL PROTECTED]> wrote Hello all, in my program I need to know what desktop environment the user is running. A few years ago I would have said that meant you had a broken design since it was very bad practice for any program to depend on the users environment. nfortunately recent dev

Re: [Tutor] How to set up dispatch function

2008-06-20 Thread Alan Gauld
"Tyler Rutschman" <[EMAIL PROTECTED]> wrote set up a dispatch function to find the proper report format for the indicated configuration. Sounds like a job for a dictionary. Just find the key and access the corresponding function. Do you know how to do that? (Use a dictionary to strore fun

[Tutor] Python and SOAP Web Services

2008-06-20 Thread Tse, William: #CIPO - OPIC
I am trying to use a SOAP Web Service with Python 2.5 and I'm following the instructions in Chapter 12 of the "Diving into Python" tutorial. It refers to three libraries that I'm having problems accessing or that appear out of date : PyXML, fpconst and SOAPpy. The tutorial also seems to be for Pyt

Re: [Tutor] Help! Character conversion from a rtf file.

2008-06-20 Thread Kent Johnson
On Fri, Jun 20, 2008 at 12:46 PM, Chien Nguyen <[EMAIL PROTECTED]> wrote: > Hi All, > I am a newbie to Python. I just did some readings on the web > and got some basic understanding about the language. I'd like > to learn the language by writing some simple programs rather than > keep reading books

Re: [Tutor] Help! Character conversion from a rtf file.

2008-06-20 Thread bob gailer
Chien Nguyen wrote: Hi All, I am a newbie to Python. I just did some readings on the web and got some basic understanding about the language. I'd like to learn the language by writing some simple programs rather than keep reading books. My first program will convert certain uni-code characters

[Tutor] os.waitpid non spawned pid

2008-06-20 Thread John [H2O]
Hello, I would like to write a script that would have a command line option of a pid# (known ahead of time). Then I want my script to wait to execute until the pid is finished. How do I accomplish this? I tried the following: #!/usr/bin/env python import os import sys def run_cmd(cmd): """RU

Re: [Tutor] Checking the desktop environment

2008-06-20 Thread Timo
Thanks for your explanation. Apparently it's not possible to detect it in all cases, but it would be nice to detect it for regular users, so people who have a default install. Well, my program needs a text-editor and a graphical box for root-password. So it checks for the desktop environment so it

Re: [Tutor] Help! Character conversion from a rtf file.

2008-06-20 Thread wesley chun
> I'd like to learn the language by writing some simple programs rather than > keep reading books. My first program will convert certain uni-code characters > (let's say UTF-8) in an RTF file format based on a certain mapping > in another RTF file that is called a "RTF Control file". > : > The

Re: [Tutor] Checking the desktop environment

2008-06-20 Thread W W
On Fri, Jun 20, 2008 at 1:48 PM, Timo <[EMAIL PROTECTED]> wrote: > Thanks for your explanation. Apparently it's not possible to detect it > in all cases, but it would be nice to detect it for regular users, so > people who have a default install. > > Well, my program needs a text-editor and a graph

[Tutor] File Stream Assignment?

2008-06-20 Thread FT
Hi! I would like to know how a file can be open for a stream event? I ask this question because of the SAPI 5 save a wave file and the only way to do that is with a file stream. The file read is simple and uses the isfilename flag, but the save file I can not find in all my searches, at

Re: [Tutor] Checking the desktop environment

2008-06-20 Thread Alan Gauld
"Timo" <[EMAIL PROTECTED]> wrote Well, my program needs a text-editor OK, That should be determined by checking the VISUAL environment variable which is the standard Unix value that a user should set to determine their preferred visual (ie full screen) text editor. The EDITOR environrnent vari

[Tutor] dollarize.py

2008-06-20 Thread Christopher Spears
I'm working on an exercise from Core Python Programming. I need to create a function that takes a float value and returns the value as string rounded to obtain a financial amount. Basically, the function does this: dollarize(1234567.8901) returns-> $1,234,567,89 The function should allow for

Re: [Tutor] Checking the desktop environment

2008-06-20 Thread Tiago Saboga
On Sat, Jun 21, 2008 at 01:00:36AM +0100, Alan Gauld wrote: > "Timo" <[EMAIL PROTECTED]> wrote > >> graphical box for root-password. > > This is the sort of thing that I meant about modern Unices messing > things up. Why on earth should anyone need a user environment > specific su box. That should

Re: [Tutor] os.waitpid non spawned pid

2008-06-20 Thread Martin Walsh
John [H2O] wrote: > Hello, I would like to write a script that would have a command line option > of a pid# (known ahead of time). Then I want my script to wait to execute > until the pid is finished. How do I accomplish this? > > I tried the following: > #!/usr/bin/env python > > import os > imp

Re: [Tutor] File Stream Assignment?

2008-06-20 Thread Kent Johnson
On Fri, Jun 20, 2008 at 5:47 PM, FT <[EMAIL PROTECTED]> wrote: >I would like to know how a file can be open for a stream event? What is a stream event? >I ask this question because of the SAPI 5 save a wave file and the only > way to do that is with a file stream. The file read is simple

Re: [Tutor] dollarize.py

2008-06-20 Thread Martin Walsh
Christopher Spears wrote: > I'm working on an exercise from Core Python Programming. I need to create a > function that takes a float value and returns the value as string rounded to > obtain a financial amount. Basically, the function does this: > > dollarize(1234567.8901) returns-> $1,234,56