Re: How to trap the event of a new process starting with wmi

2006-07-06 Thread placid
gel wrote: > gel wrote: > > > Below is how it is down with vbscript. What is the best way to convert > > this to python? > > > > strComputer = "." > > Set objWMIService = GetObject("winmgmts:" _ > > & "{impersonationLevel=impersonate}!\\" & strComputer & > > "\root\cimv2") > > Set colMonitore

Re: Nested scopes, and augmented assignment

2006-07-06 Thread Antoon Pardon
On 2006-07-05, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: > >> Python could have chosen an approach with a "nested" keyword > > sure, and Python could also have been invented by aliens, powered by > space potatoes, and been illegal to inhale in Belgium. At one time one could

Re: Installation of python on my workspace.

2006-07-06 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote: > I had two questions. I am new to Unix and Python. I wanted to get > python installed on my unix terminal without too much interference from > the administrator. How can I do this? If you have the Python sources, you can configure it to install where you tell it using the

Re: Generating multiple lists from one list

2006-07-06 Thread Amit Khemka
> On 7/6/06, Girish Sahani <[EMAIL PROTECTED]> wrote: > Thus, for the above list, my output should be: > [['a.1','b.3','c.2'],['a.1','b.4','c.2']] > Another example: Let l = ['a.1','b.3','b.4','c.2','c.6','d.3']. Then > output should be [['a.1','b.3','c.2','d.3'],['a.1','b.3','c.6','d.3'], > ['

Re: RegEx conditional search and replace

2006-07-06 Thread Martin Evans
"Juho Schultz" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Martin Evans wrote: >> Sorry, yet another REGEX question. I've been struggling with trying to >> get >> a regular expression to do the following example in Python: >> >> Search and replace all instances of "sleeping" wi

Tkinter and dialogs

2006-07-06 Thread dwelch91
I'm trying unsuccessfully to do something in Tk that I though would be easy. After Googling this all day, I think I need some help. I am admittedly very novice with Tk (I started with it yesterday), so I am sure I am overlooking something simple. The basic idea is that my application will consi

Re: XML-RPC server-client communication

2006-07-06 Thread Marco Aschwanden
> server = SimpleXMLRPCServer.SimpleXMLRPCServer(("xxx.xxx.xxx.xxx", > 22999)) Could it be that xxx.xxx.xxx.xxx stands for '127.0.0.1'? If so... rename it to 'localhost'. If you bind a port to 127.0.0.1 it will be found only on the same machine. Greetings, Marco -- http://mail.python.org/mai

Re: Generating multiple lists from one list

2006-07-06 Thread Gerard Flanagan
Girish Sahani wrote: > hello ppl, > > Consider a list like ['a.1','b.3','b.4','c.2']. Here 'a','b','c' are > objects and 1,3,4,2 are their instance ids and they are unique e.g. a.1 > and b.1 cannot exist together. From this list i want to generate > multiple lists such that each list must have o

About a month until PSF call for test trackers closes!

2006-07-06 Thread Brett Cannon
Back at the beginning of June, the Python Software Foundation's Infrastructure committee sent out an email requesting people to help us find a replacement tracker for SourceForge (the original announcement can be found at http://wiki.python.org/moin/CallForTrackers ).  We asked that people put tes

Re: Tkinter and dialogs

2006-07-06 Thread Fredrik Lundh
dwelch91 wrote: > I get no windows, not even the root Tk one. no time to dig deeper into this right now, but the culprit is probably a combination of this line self.transient(parent) and the after_idle approach to create the Dialog (Toplevel) window. the transient call tells Tkint

Need "Billy the Kid" modul for windows

2006-07-06 Thread spooky
Hey, There is a nice modul called "BtK" at http://home.student.utwente.nl/g.v.berg/btk/ Has someone a link for btk-python on windows? Thx, Spooky -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter and dialogs

2006-07-06 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, dwelch91 wrote: > When I run this (Ubuntu 6.06), I get no windows, not even the root Tk one. > > Any ideas??? > > […] > > global root > root = Tk() > root.after_idle(show_ui) > root.mainloop() What is this `after_idle()` call supposed to do? The main loop isn't running

Re: How to trap the event of a new process starting with wmi

2006-07-06 Thread gel
placid wrote: > gel wrote: > > gel wrote: > > > > > Below is how it is down with vbscript. What is the best way to convert > > > this to python? > > > > > > strComputer = "." > > > Set objWMIService = GetObject("winmgmts:" _ > > > & "{impersonationLevel=impersonate}!\\" & strComputer & > > >

Activate a daemon several times a day

2006-07-06 Thread Yves Glodt
Hi, I have a daemon which runs permanently, and I want it to do a special operation at some specifiy times every day, consider this configfile extract: [general] runat=10:00,12:00 What would be the easiest and most pythonic way to do this? Something like this pseudocode: while True:

Re: Perl Dictionary Convert

2006-07-06 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Tom Grove wrote: > I have a server program that I am writing an interface to and it returns > data in a perl dictionary. Is there a nice way to convert this to > something useful in Python? You could write a little parser with pyparsing: source = """\ { Calendar = {

Is there a Python __LINE__ ?

2006-07-06 Thread Rolf Wester
Hi, is there a Python aquivalent to the C __LINE__? Thank you in advance Regards Rolf -- http://mail.python.org/mailman/listinfo/python-list

Re: use var to form name of object

2006-07-06 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, gel wrote: > Yeah I am still getting my head around things... not exactly sure what > you where saying about the globals, but this works > > > global k > k = 5 > class foo: > > def wow(self, n): > global k > k += n >

Re: Nested scopes, and augmented assignment

2006-07-06 Thread Antoon Pardon
On 2006-07-05, Piet van Oostrum <[EMAIL PROTECTED]> wrote: >> Antoon Pardon <[EMAIL PROTECTED]> (AP) wrote: > >>AP> On 2006-07-05, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: Antoon Pardon wrote: (snip) > Well no matter what explanation you give to it, and I understand how it >

Re: Is there a Python __LINE__ ?

2006-07-06 Thread Daniel Nogradi
> Hi, > > is there a Python aquivalent to the C __LINE__? > > Thank you in advance Google says: http://www.nedbatchelder.com/blog/200410.html#e20041003T074926 -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a Python __LINE__ ?

2006-07-06 Thread Lawrence Oluyede
Rolf Wester <[EMAIL PROTECTED]> wrote: > > is there a Python aquivalent to the C __LINE__? I found this in the archives: http://groups.google.it/group/comp.lang.python/browse_thread/thread/315e f9451067a320/87785edf569c1e96?q=current+line&rnum=2#87785edf569c1e96 -- Lawrence - http://www.oluyed

numpy : argmin in multidimensional arrays

2006-07-06 Thread TG
Hi there. I am working with multi-dimensional arrays and I need to get coordinates of the min value in it. using myarray.argmin() returns the index in the flatten array, which is a first step, but I wonder if it is possible to get the coordinates directly as an array, rather than calculating them

Re: converting file formats to txt

2006-07-06 Thread BJörn Lindqvist
On 4 Jul 2006 08:38:47 -0700, Gaurav Agarwal <[EMAIL PROTECTED]> wrote: > Thanks Steven, Actually i wanted a do text processing for my office > where I can view all files in the system and use the first three to > give a summary of the document. Instead of having somebody actually > entering the su

Re: Finding Return Code From GPG

2006-07-06 Thread Martin Renold
* Dennis Benzinger <[EMAIL PROTECTED]>: > Nomen Nescio wrote: > > I'm running gpg in python to verify a signature. > > But I need a way to let the python script know this. I have written a script to verify signatures using gpg some time ago, maybe this helps you: http://old.homeip.net/martin/sig

eval to dict problems NEWB going crazy !

2006-07-06 Thread manstey
Hi, I have a text file called a.txt: # comments [('recId', 3), ('parse', {'pos': u'np', 'gen': u'm'})] [('recId', 5), ('parse', {'pos': u'np', 'gen': u'm'})] [('recId', 7 ), ('parse', {'pos': u'np', 'gen': u'm'})] I read it using this: filAnsMorph = codecs.open('a.txt', 'r', 'utf-8') # Initiali

Re: How to trap the event of a new process starting with wmi

2006-07-06 Thread placid
gel wrote: > placid wrote: > > > gel wrote: > > > gel wrote: > > > > > > > Below is how it is down with vbscript. What is the best way to convert > > > > this to python? > > > > > > > > strComputer = "." > > > > Set objWMIService = GetObject("winmgmts:" _ > > > > & "{impersonationLevel=impers

looping question 4 NEWB

2006-07-06 Thread manstey
Hi, I often have code like this: data='asdfbasdf' find = (('a','f')('s','g'),('x','y')) for i in find: if i[0] in data: data = data.replace(i[0],i[1]) is there a faster way of implementing this? Also, does the if clause increase the speed? Thanks, Matthew -- http://mail.python.org/m

Re: Nested scopes, and augmented assignment

2006-07-06 Thread Bruno Desthuilliers
Antoon Pardon wrote: > On 2006-07-05, Piet van Oostrum <[EMAIL PROTECTED]> wrote: > >>>Antoon Pardon <[EMAIL PROTECTED]> (AP) wrote: >> >>>AP> On 2006-07-05, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >>> >Antoon Pardon wrote: >(snip) > >>Well no matter what explanation you

I thought I'd 'got' globals but...

2006-07-06 Thread meridian
I thought I had 'got' globals but this one seems strange. I want my example function 'doIt' to use and optionally modify a module variable 'gname', so I declare 'global gname' in the function, but when modified it doesn't stay modified. gname = 'Sue' def doIt(name = gname): global gname gn

rare error with python at execution

2006-07-06 Thread Luis Morales
I was trying the win32api to gather some system information.   But now I get this error everytime I run a script and I have no idea. It can be a simple print ‘hello’ that it wont work   This is the error I get   'import site' failed; use -v for traceback Traceback (most recent call l

Re: I thought I'd 'got' globals but...

2006-07-06 Thread Bruno Desthuilliers
meridian wrote: > I thought I had 'got' globals but this one seems strange. > I want my example function 'doIt' to use and optionally modify a module > variable 'gname', so I declare 'global gname' in the function, but when > modified it doesn't stay modified. > > gname = 'Sue' > def doIt(name = g

Re: numpy : argmin in multidimensional arrays

2006-07-06 Thread Travis E. Oliphant
TG wrote: > Hi there. > > I am working with multi-dimensional arrays and I need to get > coordinates of the min value in it. > > using myarray.argmin() returns the index in the flatten array, which is > a first step, but I wonder if it is possible to get the coordinates > directly as an array, ra

Re: eval to dict problems NEWB going crazy !

2006-07-06 Thread Bruno Desthuilliers
manstey wrote: > Hi, > > I have a text file called a.txt: > > # comments > [('recId', 3), ('parse', {'pos': u'np', 'gen': u'm'})] > [('recId', 5), ('parse', {'pos': u'np', 'gen': u'm'})] > [('recId', 7 ), ('parse', {'pos': u'np', 'gen': u'm'})] > > I read it using this: > > filAnsMorph = codecs

Re: looping question 4 NEWB

2006-07-06 Thread Roel Schroeven
manstey schreef: > Hi, > > I often have code like this: > > data='asdfbasdf' > find = (('a','f')('s','g'),('x','y')) > for i in find: >if i[0] in data: >data = data.replace(i[0],i[1]) > > is there a faster way of implementing this? Also, does the if clause > increase the speed? I th

Re: looping question 4 NEWB

2006-07-06 Thread Wolfram Kraus
On 06.07.2006 12:43, manstey wrote: > Hi, > > I often have code like this: > > data='asdfbasdf' > find = (('a','f')('s','g'),('x','y')) > for i in find: >if i[0] in data: >data = data.replace(i[0],i[1]) > > is there a faster way of implementing this? Also, does the if clause > increa

Re: looping question 4 NEWB

2006-07-06 Thread manstey
But what about substitutions like: 'ab' > 'cd', 'ced' > 'de', etc what is the fastest way then? Roel Schroeven wrote: > manstey schreef: > > Hi, > > > > I often have code like this: > > > > data='asdfbasdf' > > find = (('a','f')('s','g'),('x','y')) > > for i in find: > >if i[0] in data: > >

Re: looping question 4 NEWB

2006-07-06 Thread bearophileHUGS
manstey: > is there a faster way of implementing this? Also, does the if clause > increase the speed? I doubt the if increases the speed. The following is a bit improved version: # Original data: data = 'asdfbasdf' find = (('a', 'f'), ('s', 'g'), ('x', 'y')) # The code: data2 = data for pat,rep

setting variables from a tuple NEWB

2006-07-06 Thread manstey
Hi, If I have a tuple like this: tupGlob = (('VOWELS','aeiou'),('CONS','bcdfgh')) is it possible to write code using tupGlob that is equivalent to: VOWELS = 'aeiou' CONS = ''bcdfgh' Thanks, Matthew -- http://mail.python.org/mailman/listinfo/python-list

Re: I thought I'd 'got' globals but...

2006-07-06 Thread meridian
Bruno Desthuilliers wrote: > def doIt(name=None): > global gname > if name is None: > name = gname > else: > gname = name > Thanks Bruno, works a treat... -- http://mail.python.org/mailman/listinfo/python-list

Re: eval to dict problems NEWB going crazy !

2006-07-06 Thread manstey
That doesn't work. I just get an error: x = eval(line.strip('\n')) File "", line 1 [('recId', 3), ('parse', {'pos': u'np', 'gen': u'm'})] SyntaxError: unexpected EOF while parsing any other ideas? Bruno Desthuilliers wrote: > manstey wrote: > > Hi, > > > > I have a text file called

Re: rare error with python at execution

2006-07-06 Thread Fredrik Lundh
Luis Morales wrote: > But now I get this error everytime I run a script and I have no idea. It can > be a simple print 'hello' that it wont work > > This is the error I get > > 'import site' failed; use -v for traceback > > Traceback (most recent call last): > > File "D:\Archivos de programa\Acti

Re: eval to dict problems NEWB going crazy !

2006-07-06 Thread Eric Deveaud
manstey wrote: > That doesn't work. I just get an error: > > x = eval(line.strip('\n')) >File "", line 1 > [('recId', 3), ('parse', {'pos': u'np', 'gen': u'm'})] > > SyntaxError: unexpected EOF while parsing > is the last line of your file empty ?? what with for line in filA

Re: I thought I'd 'got' globals but...

2006-07-06 Thread Bruno Desthuilliers
meridian wrote: > Bruno Desthuilliers wrote: > >>def doIt(name=None): >> global gname >> if name is None: >>name = gname >> else: >>gname = name >> > > > Thanks Bruno, works a treat... > But still very probably a bad idea. -- bruno desthuilliers python -c "print '@'.join(['.'.join(

searching for strings (in a tuple) in a string

2006-07-06 Thread manstey
Hi, I often use: a='yy' tup=('x','yy','asd') if a in tup: <...> but I can't find an equivalent code for: a='xfsdfyysd asd x' tup=('x','yy','asd') if tup in a: < ...> I can only do: if 'x' in a or 'yy' in a or 'asd' in a: <...> but then I can't make the if clause dependent on changin

Re: eval to dict problems NEWB going crazy !

2006-07-06 Thread Fredrik Lundh
"manstey" <[EMAIL PROTECTED]> wrote: > That doesn't work. I just get an error: > >x = eval(line.strip('\n')) > File "", line 1 > [('recId', 3), ('parse', {'pos': u'np', 'gen': u'm'})] > > SyntaxError: unexpected EOF while parsing > > any other ideas? hint 1: >>> eval("[('recId', 3), ('p

Re: numpy : argmin in multidimensional arrays

2006-07-06 Thread TG
thanks. unravel_index do the trick. Travis E. Oliphant wrote: > TG wrote: > > Hi there. > > > > I am working with multi-dimensional arrays and I need to get > > coordinates of the min value in it. > > > > using myarray.argmin() returns the index in the flatten array, which is > > a first step, but

Re: searching for strings (in a tuple) in a string

2006-07-06 Thread [EMAIL PROTECTED]
You can get the matching elements with a list comprehension with something like py> a='xfsdfyysd asd x' py> tup=('x','yy','asd') py> [x for x in tup if x in a.split()] ['x', 'asd'] Hope this helps manstey wrote: > Hi, > > I often use: > > a='yy' > tup=('x','yy','asd') > if a in tup: ><...> >

Re: searching for strings (in a tuple) in a string

2006-07-06 Thread Fredrik Lundh
"manstey" <[EMAIL PROTECTED]> wrote: > but I can't find an equivalent code for: > > a='xfsdfyysd asd x' > tup=('x','yy','asd') > if tup in a: > < ...> > > I can only do: > > if 'x' in a or 'yy' in a or 'asd' in a: > <...> > > but then I can't make the if clause dependent on changing value of t

Re: eval to dict problems NEWB going crazy !

2006-07-06 Thread Roel Schroeven
manstey schreef: > Hi, > > I have a text file called a.txt: > > # comments > [('recId', 3), ('parse', {'pos': u'np', 'gen': u'm'})] > [('recId', 5), ('parse', {'pos': u'np', 'gen': u'm'})] > [('recId', 7 ), ('parse', {'pos': u'np', 'gen': u'm'})] > > I read it using this: > > filAnsMorph = code

Re: Is there a Python __LINE__ ?

2006-07-06 Thread Rolf Wester
Thank you very much for your help. Regards Rolf -- http://mail.python.org/mailman/listinfo/python-list

Re: searching for strings (in a tuple) in a string

2006-07-06 Thread manstey
I know I can do it this way. I wanted to know if there was another way. Fredrik Lundh wrote: > "manstey" <[EMAIL PROTECTED]> wrote: > > > but I can't find an equivalent code for: > > > > a='xfsdfyysd asd x' > > tup=('x','yy','asd') > > if tup in a: > > < ...> > > > > I can only do: > > > > if 'x

Re: looping question 4 NEWB

2006-07-06 Thread Roel Schroeven
manstey schreef: > Roel Schroeven wrote: >> manstey schreef: >>> I often have code like this: >>> >>> data='asdfbasdf' >>> find = (('a','f')('s','g'),('x','y')) >>> for i in find: >>>if i[0] in data: >>>data = data.replace(i[0],i[1]) >>> >>> is there a faster way of implementing this? A

Re: eval to dict problems NEWB going crazy !

2006-07-06 Thread Fredrik Lundh
> hint 1: hint 1b: >>> eval("[('recId', 3), ('parse', {'pos': u'np', 'gen': u'm'})]") [('recId', 3), ('parse', {'pos': u'np', 'gen': u'm'})] >>> eval("[('recId', 3), ('parse', {'pos': u'np', 'gen': u'm'})]\n") [('recId', 3), ('parse', {'pos': u'np', 'gen': u'm'})] >>> eval("[('recId', 3), ('parse

Re: RegEx conditional search and replace

2006-07-06 Thread Anthra Norell
>>> import SE >>> Editor = SE.SE ('sleeping=dead sleeping.htm== sleeping<==') >>> Editor ('This parrot is sleeping. Really, it is sleeping.' 'This parrot is sleeping. Really, it is dead.' Or: >>> Editor ( (name of htm file), (name of output file) ) Usage: You make an explicit list of what you want

Re: searching for strings (in a tuple) in a string

2006-07-06 Thread Fredrik Lundh
"manstey" <[EMAIL PROTECTED]> wrote: >I know I can do it this way. I wanted to know if there was another way. if you don't want to write Python programs, why are you using Python ? -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: Intro to Python course, Aug 16-18, San Francisco

2006-07-06 Thread Stefan Behnel
w chun wrote: > What: (Intense) Intro to Python > When: August 16-18, 2006 > Where: San Francisco (SFO/San Bruno), CA, USA Interesting! Now that you mention it, I remember wanting to organise an extensive Python course in Bornhövede, Germany. However, there's only some 16 people living in the c

Re: RegEx conditional search and replace

2006-07-06 Thread mbstevens
On Thu, 06 Jul 2006 08:32:46 +0100, Martin Evans wrote: > "Juho Schultz" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Martin Evans wrote: >>> Sorry, yet another REGEX question. I've been struggling with trying to >>> get >>> a regular expression to do the following example i

Re: I thought I'd 'got' globals but...

2006-07-06 Thread meridian
Bruno Desthuilliers wrote: > meridian wrote: > > Bruno Desthuilliers wrote: > > > >>def doIt(name=None): > >> global gname > >> if name is None: > >>name = gname > >> else: > >>gname = name > >> > > > > > > Thanks Bruno, works a treat... > > > But still very probably a bad idea. > Ok, m

Help Needed !!! Browsing and Selecting More Than One File

2006-07-06 Thread Kilicaslan Fatih
Dear All, I am trying to create a GUI, using Tkinter on Windows 2000/XP using Python 2.2. Through buttons this GUI interacts with another program and assigns argument to that program. I managed to browse a ".c" file and assign this file as an argument to the other program written in C/C++ Program

Re: I thought I'd 'got' globals but...

2006-07-06 Thread meridian
You mentioned earlier that "Modifying globals from within a function is usually a very bad idea." Most of my app consists of functions or class/object functions, that's all I do in OOP. Did you mean that modifying globals from anywhere is bad? or globals are bad? or don't code using methods/funct

Re: Help Needed !!! Browsing and Selecting More Than One File

2006-07-06 Thread Diez B. Roggisch
Kilicaslan Fatih schrieb: > Dear All, > > I am trying to create a GUI, using Tkinter on Windows > 2000/XP using Python 2.2. Through buttons this GUI > interacts with another program and assigns argument to > that program. > > I managed to browse a ".c" file and assign this file > as an argument t

Python password display

2006-07-06 Thread Johhny
Hello, I am currently writing some python code which requires the use of a password. Currently I am using the raw_input function to take the users input in and use it. One problem with that is the password is displayed in clear text on the console of the server. I would like to work on a way aroun

Help Needed !!! Browsing and Selecting More Than One File

2006-07-06 Thread Kilicaslan Fatih
Dear Diez B. Roggisch, After clicking a button on the GUI the user can browse and than select a ".c" file to assign to the other program I have mentioned. But in this way I can only select one file. I don't know how to implement this application for all of the "*.c" files in a folder. Do I need t

Re: Python password display

2006-07-06 Thread Bill Scherer
Johhny wrote: > Hello, > > I am currently writing some python code which requires the use of a > password. Currently I am using the raw_input function to take the users > input in and use it. One problem with that is the password is displayed > in clear text on the console of the server. I would l

Re: XML-RPC + SimpleHTTPServer question

2006-07-06 Thread Tal Einat
I have recently implemented a system where clients connect to an RPC server (RPyC in my case), run a webserver on the RPC server, and close the webserver when they're done with it. To do this I wrote a ServerThread class which wraps a SimpleHTTPServer, runs as a thread, and can be signalled to sto

Re: python list/array question...

2006-07-06 Thread Vic . Kelson
Another way to do it is using a dict with keys that are tuples: >>> arr = {} >>> arr[0,0] = 'a1' >>> arr[0,1] = 'a2' >>> arr[1,0] = 'b1' >>> arr[1,1] = 'b2' >>> arr[2,0] = 'c1' >>> arr[2,1] = 'c2' >>> for j in range(3): ... for i in range(2): ... print arr[j,i], ' ', ... print ...

Re: Very practical question

2006-07-06 Thread madpython
Thank you all for your comments. They are priceless beyond any doubt. As for the matter of the discussion it took me only a minute looking at the code to realize that with Tkinter I pass "master" reference to every widget and therefore I can access every method in the class hierarchy. I'm a fool th

Re: RegEx conditional search and replace

2006-07-06 Thread Martin Evans
"mbstevens" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Thu, 06 Jul 2006 08:32:46 +0100, Martin Evans wrote: > >> "Juho Schultz" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >>> Martin Evans wrote: Sorry, yet another REGEX question. I've been struggling

getting current UNIX uid

2006-07-06 Thread Johhny
Hello, I am trying to get the user that is running the scripts uid, I have had a look at the pwd module and it does not appear to offer that functionality. Is there any way within python to get that information ? Regards, Johhny -- http://mail.python.org/mailman/listinfo/python-list

Re: Help Needed !!! Browsing and Selecting More Than One File

2006-07-06 Thread Eric Brunel
(Please quote at least a significant part of the message you're replying to, or people will have trouble understanding what you're talking about...) On Thu, 06 Jul 2006 15:42:28 +0200, Kilicaslan Fatih <[EMAIL PROTECTED]> wrote: > Dear Diez B. Roggisch, > > After clicking a button on the GUI t

Re: getting current UNIX uid

2006-07-06 Thread Eric Deveaud
Johhny wrote: > Hello, > > I am trying to get the user that is running the scripts uid, I have had > a look at the pwd module and it does not appear to offer that > functionality. Is there any way within python to get that information ? eg: username = pwd.getpwuid(os.getuid())[4] Eri

Re: getting current UNIX uid

2006-07-06 Thread Richie Hindle
[Johhny] > I am trying to get the user that is running the scripts uid, I have had > a look at the pwd module and it does not appear to offer that > functionality. Is there any way within python to get that information ? It's in the 'os' module: >>> import os >>> os.getuid() 553 -- Richie Hind

ElementTree : parse string input

2006-07-06 Thread rajarshi . guha
Hi, recently having discovered ElementTree I'm stumped by a very simple problem, which I can't find the answer to. I have some XML in a string object. Now the parse() method of ElementTree takes a filename or file-like object. So I tried creating a StringIO object from the original string and then

Countdown timer for different timezones

2006-07-06 Thread Dirk Hagemann
Hi! I'd like to implement a countdown timer on a webite. It should show the months, days, hours, minutes and seconds until a given date and time. So far it's not really difficult, but this website will be used from different time zones, what will make a difference of 10 hours, if I use the time-in

Re: numarray

2006-07-06 Thread Claudio Grondi
bruce wrote: > robert > > i did an > python>>> import numpy > a = array([['q','a'],['w','e']]) not tested, but you usually need to mention where to find array: a = numpy.array([['q','a'],['w','e']]) > > and it didn't work... > > i used > >>from import numpy * > > and it seems to

Re: setting variables from a tuple NEWB

2006-07-06 Thread Paul McGuire
"manstey" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > If I have a tuple like this: > > tupGlob = (('VOWELS','aeiou'),('CONS','bcdfgh')) > > is it possible to write code using tupGlob that is equivalent to: > VOWELS = 'aeiou' > CONS = ''bcdfgh' > > Thanks, > Matthew > Try

Re: ElementTree : parse string input

2006-07-06 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > Hi, recently having discovered ElementTree I'm stumped by a very simple > problem, which I can't find the answer to. > > I have some XML in a string object. Now the parse() method of > ElementTree takes a filename or file-like object. So I tried creating a > StringIO ob

Re: searching for strings (in a tuple) in a string

2006-07-06 Thread Simon Forman
manstey wrote: > Hi, > > I often use: > > a='yy' > tup=('x','yy','asd') > if a in tup: ><...> > > but I can't find an equivalent code for: > > a='xfsdfyysd asd x' > tup=('x','yy','asd') > if tup in a: >< ...> > > I can only do: > > if 'x' in a or 'yy' in a or 'asd' in a: ><...> > > but

Re: Countdown timer for different timezones

2006-07-06 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Dirk Hagemann wrote: > I'd like to implement a countdown timer on a webite. It should show the > months, days, hours, minutes and seconds until a given date and time. > So far it's not really difficult, but this website will be used from > different time zones, what will ma

Re: setting variables from a tuple NEWB

2006-07-06 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Paul McGuire wrote: tupGlob = (('VOWELS','aeiou'),('CONS','bcdfgh')) for nam,val in tupGlob: locals()[nam]=val > ... VOWELS > 'aeiou' CONS > 'bcdfgh' Little warning: It works only on module level as assigning to `locals()` return value in function

Re: looping question 4 NEWB

2006-07-06 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, manstey wrote: > I often have code like this: > > data='asdfbasdf' > find = (('a','f')('s','g'),('x','y')) > for i in find: >if i[0] in data: >data = data.replace(i[0],i[1]) > > is there a faster way of implementing this? Also, does the if clause > increase th

Re: mirroring object attributes using xml-rpc

2006-07-06 Thread skip
sashang> Then the client code can get the value of i like this: sashang> c = xmlrpclib.ServerProxy("address") sashang> c.geti() sashang> but why can't I get the value of i like this? sashang> c.i "RPC" stands for "Remote Procedure Call". You're looking for a remote object a

Re: looping question 4 NEWB

2006-07-06 Thread Simon Forman
[EMAIL PROTECTED] wrote: > manstey: > > is there a faster way of implementing this? Also, does the if clause > > increase the speed? > > I doubt the if increases the speed. The following is a bit improved > version: > > # Original data: > data = 'asdfbasdf' > find = (('a', 'f'), ('s', 'g'), ('x', '

Re: handling unicode data

2006-07-06 Thread Filipe
Hi Martin, > One would have to ask the authors of pymssql, or Microsoft, > why that happens; alternatively, you have to run pymssql > in a debugger to find out yourself. Tried running pymssql in a debugger, but I felt a bit lost. There are too many things I would need to understand about pymssql

Re: Nested scopes, and augmented assignment

2006-07-06 Thread Piet van Oostrum
> Antoon Pardon <[EMAIL PROTECTED]> (AP) wrote: >AP> Well if someone explains what is wrong about my understanding, I >AP> certainly care about that (although I confess to sometimes being >AP> impatient) but someone just stating he is not sure I understand? That is just a euphemistic way of s

fastcgi: how to accept HTTP requests, and return a result

2006-07-06 Thread thorley
Greetings, I'm now merrily on my way developing a FastCGI Server in python. Thanks to help of others on this list I've got a proof of concept up and running. Herein lies my question: My goal is to make this module as flexible as possible, so that it can receive requests from SimpleHTTP, or Cherrpy

Re: setting variables from a tuple NEWB

2006-07-06 Thread nate
manstey wrote: > Hi, > > If I have a tuple like this: > > tupGlob = (('VOWELS','aeiou'),('CONS','bcdfgh')) > > is it possible to write code using tupGlob that is equivalent to: > VOWELS = 'aeiou' > CONS = ''bcdfgh' could you use a dictionary instead? i.e. >>> tupGlob = {'VOWELS':'aeiou', 'CONS':'

Re: ElementTree : parse string input

2006-07-06 Thread Amit Khemka
> On 6 Jul 2006 07:38:10 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Any pointers to getting ElementTree to parse from a string would be > appreciated (of course I could dump it to a temp file, but that doesn't > seem elegent) You can use the "fromstring" method. Btw, did you looked at c

Re: Activate a daemon several times a day

2006-07-06 Thread Amit Khemka
did you considered using signals ?! I guess that could well serve the purpose .. more of signals: http://docs.python.org/lib/module-signal.html cheers, amit. On 7/6/06, Yves Glodt <[EMAIL PROTECTED]> wrote: > Hi, > > I have a daemon which runs permanently, and I want it to do a special > operat

Re: Activate a daemon several times a day

2006-07-06 Thread Simon Forman
Yves Glodt wrote: > Hi, > > I have a daemon which runs permanently, and I want it to do a special > operation at some specifiy times every day, consider this configfile > extract: > > [general] > runat=10:00,12:00 > > > What would be the easiest and most pythonic way to do this? > Something like th

Re: Activate a daemon several times a day

2006-07-06 Thread Simon Forman
Yves Glodt wrote: > while True: > if now(hours) in runat: > act() > sleep(60) > sleep(10) > Note that, if "now(hours)" *is* in runat, this loop will sleep 70 seconds, not 60. It probably doesn't matter. -- http://mail.python.org/mailman/listinfo/python

python/xpath question...

2006-07-06 Thread bruce
for guys with python/xpath expertise.. i'm playing with xpath.. and i'm trying to solve an issue... i have the following kind of situation where i'm trying to get certain data. i have a bunch of tr/td... i can create an xpath, that gets me all of the tr.. i only want to get the sibling tr up un

web app breakage with utf-8

2006-07-06 Thread elmo
Hello, after two days of failed efforts and googling, I thought I had better seek advice or observations from the experts. I would be grateful for any input. We have various small internal web applications that use utf-8 pages for storing, searching and retrieving user input. They have worked fine

Python SOAP and XML-RPC performance extremely low?

2006-07-06 Thread Jack
When I try TooFPy with the SOAP and XML-RPC sample client code provided in TooFPy tutorials, a log entry shows up quickly on web server log window, but it takes a long time (5 seconds or longer) for the client to output a "Hello you." It seems like the web server is fast because the log entry show

Looking for a high performance web server written in Python, and supports CGI/FastCGI

2006-07-06 Thread Jack
Basically I am trying to find a high performance web server. Since Python is installed on all of the servers, It'll be great if the web server is written in Python as well. Otherwise, I will have to install lighttpd or other web servers. Then the largest issue with Python-based web servers is perf

Re: Very practical question

2006-07-06 Thread Simon Forman
madpython wrote: > ... > self.b=Tkinter.Button(root,txt="Button",command=self.doSmth).pack() > self.l=Tkinter.Label(root,txt="default").pack() > def doSmth(self): > var=globals()["m"].__dict__["progLogic"].func("some > input") > self.l.config(txt=var) > self.l.update_

Re: Looking for a high performance web server written in Python, and supports CGI/FastCGI

2006-07-06 Thread Jean-Paul Calderone
On Thu, 6 Jul 2006 09:36:25 -0700, Jack <[EMAIL PROTECTED]> wrote: >Basically I am trying to find a high performance web server. Since >Python is installed on all of the servers, It'll be great if the web >server is written in Python as well. Otherwise, I will have to install >lighttpd or other web

Re: python/xpath question...

2006-07-06 Thread Stefan Behnel
bruce wrote: > for guys with python/xpath expertise.. > > i'm playing with xpath.. and i'm trying to solve an issue... > > i have the following kind of situation where i'm trying to get certain data. > > i have a bunch of tr/td... > > i can create an xpath, that gets me all of the tr.. i only w

Re: Python SOAP and XML-RPC performance extremely low?

2006-07-06 Thread skip
Jack> When I try TooFPy with the SOAP and XML-RPC sample client code Jack> provided in TooFPy tutorials, a log entry shows up quickly on web Jack> server log window, but it takes a long time (5 seconds or longer) Jack> for the client to output a "Hello you." For XML-RPC are you u

Re: web app breakage with utf-8

2006-07-06 Thread Stefan Behnel
elmo wrote: > Hello, after two days of failed efforts and googling, I thought I had > better seek advice or observations from the experts. I would be grateful > for any input. > > We have various small internal web applications that use utf-8 pages for > storing, searching and retrieving user inpu

what's wrong here? (search script)

2006-07-06 Thread Brendan Fay
Dear Someone: I have written a script that accesses the googleAPI through pygoogle and saves each of the ten documents as a .txt file by using a specific function for each respective file type (.doc, .pdf, .html) to convert it to such. Everything works fine, except that I am trying to make i

  1   2   >