How to call application in the background with subprocess.call

2010-04-08 Thread jorma kala
Hi, I'd like to call an external application (firefox) from a python program (a PyQT GUI), but I want the external application to run in the background, I mean I do not want my python calling program to wait till the external subprocess terminates. I've tried this: call(["firefox", "http://www.py

Re-enabling a logger

2009-10-22 Thread jorma kala
Hi, I'm using the logging module. At one point in my code I disable logging like this: logging.disable(logging.INFO) But how can I enable the logging again further on? I've tried the following, which doesn't work for re-enabling the logger: my_logger.setLevel(logging.INFO) I've also tried to d

logger module : Question about log message format

2009-09-04 Thread jorma kala
Hi, I've created a logger like this: LOG_FILENAME = 'test.txt' fh=logging.FileHandler(LOG_FILENAME,'w') logger1 = logging.getLogger('myLogger1') logger1.addHandler(fh) logger1.setLevel(logging.INFO) logger1.info('message from logger1') and was hoping to get log messages in this format in my log

Re: Question about apply

2009-09-03 Thread jorma kala
Many thanks!! On Thu, Sep 3, 2009 at 4:21 PM, Gary Herron wrote: > jorma kala wrote: > >> >> Hi, >> I'm using apply to pass keyword arguments as a dictionary to a funcion at >> runtime (which keyword arguments to pass is only known at runtime) >>

Question about apply

2009-09-03 Thread jorma kala
Hi, I'm using apply to pass keyword arguments as a dictionary to a funcion at runtime (which keyword arguments to pass is only known at runtime) apply is very handy for this, because it takes a dictionary of keyword arguments directly def f1(a=None,b=None,c=None): pass kw={'a':1} apply(f1,

Re: How to document Python code properly for Pydoc

2009-07-23 Thread jorma kala
Thanks very much for your help On Wed, Jul 22, 2009 at 6:43 PM, Lie Ryan wrote: > jorma kala wrote: > > Hi, > > Do you know where I can find the rules for documenting Python code, so > > that automatic document generation with Pydoc makes the most of the > > co

How to document Python code properly for Pydoc

2009-07-22 Thread jorma kala
Hi, Do you know where I can find the rules for documenting Python code, so that automatic document generation with Pydoc makes the most of the comments inserted in the code? I know about documenting class and method through triple quote just under the class definition. But how do you comment a spec

Retrieving column values by column name with MySQLdb

2009-06-19 Thread jorma kala
Hi, Is there a way of retrieving the value of columns in the rows returned by fetchall, by column name instead of index on the row? Code Snippet: query="select * from employees" db=MySQLdb.connect(host=host,user=user,passwd=passwd,db=database) cursor = db.cursor () cursor.execu

Accessing files in a directory which is a shortcut link (Windows)

2009-05-02 Thread jorma kala
Hi, I'd like to process files in a directory which is in fact a short cut link to another directory (under windows XP). If the path to the directory is for instance called c:\test. I have tried both following code snipets for printing all names of files in the directory: ++ snippet 1++ for f

Re: Using ascii numbers in regular expression

2009-04-28 Thread jorma kala
s. Thanks a lot On Tue, Apr 28, 2009 at 12:45 PM, Chris Rebert wrote: > On Tue, Apr 28, 2009 at 4:05 AM, jorma kala wrote: > > Hi, > > > > How can I use the ascii number of a character in a regular expression > > (module re) instead of the character itself? > &

Using ascii numbers in regular expression

2009-04-28 Thread jorma kala
Hi, How can I use the ascii number of a character in a regular expression (module re) instead of the character itself? Thanks very much -- http://mail.python.org/mailman/listinfo/python-list

Using ZSI Soap libraries from behind a proxy-based firewall

2008-11-04 Thread jorma kala
Hi I'm trying to build a simple soap client using the ZSI library. My python script operates from behind a proxy-based firewall. Do you know how I can specify the proxy name and port to use, when using the ZSI client. ( using the urllib2, this can be done through ProxyHandler, for instance. But I

Using httplib to access servlets on tomcat server

2008-09-03 Thread jorma kala
Hi, I'm trying unsuccesfully to use the httplib library to execute servlets on a local tomcat server. If I type the following http adress on my browser http://localhost:8080/test/Serv1 the servlet works fine. But if I try to access it with the following python code: conn = httplib.HTTPConnec

Retrieving http headers from HTTPConnection object

2008-09-01 Thread jorma kala
Hi, when using httplib for http requests, like for example: conn = httplib.HTTPConnection("www.python.org") conn.request("GET", "/index.html") Is it possible to retrieve the complete http request in string form : GET /index.html HTTP/1.1 Host: www.python.org User-Agent: ... Accept: .

Automating GUI interaction with Python

2008-02-20 Thread jorma kala
Hi, Is there a python library or bindings to a library in some other language for automating GUI interaction (the kind of functionality provided by Autoit for instance). What I need to do is very simple GUI automation : moving the mouse cursor to and from specified screen coordinates, clicking, et

getpixel with Python Imaging Library

2007-11-30 Thread jorma kala
Hi, I read that the getpixel function of the PIL library is relatively slow. Which alternative is therefore faster and more efficient, accesing the result of getdata() as a flat list or using the function load(), and accessing pixels through the resulting 2-dimensional array? Thanks a lot. j. ka

Problem using subprocess.Popen on windows

2007-10-07 Thread jorma kala
Hi, I get an error that I don't understand when using the subprocess module on Windows. I guess I'm missing out something very basic. For instance, to execute and capture the output of the ms-dos dir command, I tried the following: from subprocess import * p1 = Popen(["dir"], stdout=PIPE) outp

Using ImageGrab (PIL) to capture screen of remote computer

2007-10-02 Thread jorma kala
Hi, Is it possible to use ImageGrab of the Python Imaging Library to capture the screen of a remote computer? I'm running my python program on a computer that is connected directly via a ethernet crossover cable to another computer. Can I somehow get ImageGrab to grab the display of the remote co