python

obtaining pid of child process

Hi, I am using python's multiprocessing module to spawn new process as follows : import multiprocessing import os d = multiprocessing.Process(target=os.system,args=('iostat 2 > a.txt',)) d.start() I want to obtain pid of iostat command or the command executed using multiprocessing module When I execute : d.pid it gives me ...

How can I improve this code

I'm writing a threading.Thread subclass that implements 'callable' methods. Normally with an arbitrary method on a thread, the method runs in whatever thread calls it. These methods run in the thread that they are called on and either block further execution in the calling thread or return a means to get the result depending on which de...

How do I get python.vim to work with vim?

I am playing around with vim and I heard that python.vim has some nifty settings for python. Link to python.vim http://www.vim.org/scripts/script.php?script_id=790 Q1: How do I integrate python.vim with vim? Q2: Because I am not familiar with vim, if I use something like python.vim will it have a crazy effect on non-python files or w...

GPL and test cases?

Hi Stack Overflow - I am developing a pure-Python module as a drop-in replacement for a C extension module. This C extension module is GPL'd and has unit tests written in Python. If I am developing open-source software under the MIT, am I able to re-use these test cases in my project? ...

How to capture the text wthin the brackets: (), using regex maybe?

any way would be fine. Perl, python, ruby... ...

OOP python-oriented tutorials?

I look for python tutorial but dealing with OOP, I don't need conditions, loops and other stuff, only OOP things and python decorators, generators, etc etc. And I look for tutorial with practical examples, which make sense, not Fibonacci, I can't learn from abstract non-useful examples. If it will be some part of some python framework tu...

What's the best way to get a description of the website, in Python?

Suppose I downloaded the HTML code, and I can parse it. How do I get the "best" description of that website, if that website does not have meta-description tag? ...

I want to pass variable to CSS.

I want to pass variables in CSS. But the condition is that the CSS file is not my control. So, is there any way? If yes, please help me out. can i access my css file on fly by using python script? ...

Google app engine parsing xml more then 1 mb

Hi i need to parse xml file which is more then 1 mb in size, i know GAE can handle request and response up to 10 MB but as we need to use SAX parser API and API GAE has limit of 1 MB so is there way we can parse file more then 1 mb any ways. ...

how to get started with google app-engine?

I m starting to build python application in windows platform using google appengine whats the steps to debug and run my application ...

How can I upgrade the sqlite3 package in Python 2.6?

I was using Python 2.6.5 to build my application, which came with sqlite3 3.5.9. Apparently though, as I found out in another question of mine, foreign key support wasn't introduced in sqlite3 until version 3.6.19. However, Python 2.7 comes with sqlite3 3.6.21, so this work -- I decided I wanted to use foreign keys in my application, so ...

python: overriding access a var

I have a class: class A: s = 'some string' b = <SOME OTHER INSTANCE> now I want this class to have the functionality of a string whenever it can. That is: a = A() print a.b will print b's value. But I want functions that expect a string (for example replace) to work. For example: 'aaaa'.replace('a', a) to actually do: '...

Should I use Pylon's Paste to host my Pylons website? Or can I use Apache?

I'm looking into Pylons and was wondering, should I use Paste as the webserver or can I use Apache? Are there advantages to using Paste? Would you recommend against using Apache? How should I host the sites? ...

How can I check with Python which Window Manager is running?

I want to check which Window Manager the user is using (like GNOME or KDE etc.). How do I do that? ...

NameError for using timeit in python

I got NameError when I try to run this codes."global name j is not defined". How can I fix it? def test(j): for i in range(j): j = i**2 if __name__=='__main__': from timeit import Timer j = 30 t = Timer("test(j)","from __main__ import test") print( t.timeit(j)) ...

stdout to tkinter GUI

Hi, How can I redirect stdout data to a tkinter Text widget? Much obliged, Dennis ...

Finding what list a class instance is in, in Python.

This problem is thus: I have an instance of a class, I want to know what list it is a part of, i.e. : class test_class() : def test() : print 'I am a member of list', parent_list foo = [test_class(), 52, 63] bar = ['spam', 'eggs'] foo[0].test() I would like to print out I am a member of list foo. There are an arbitrary nu...

Is there an online IDE for Google App Engine?

I am learning Google App Engine / Python and I love it. Unfortunately I am not allowed to use my own computer in the office and not allowed to install anything on the corporate machine. It would be so great to have an online IDE for Google App Engine where I could play with my Python code using any browser, including the one on my iPad....

how to deal with unicode in mako?

I constantly get this error using mako: UnicodeEncodeError: 'ascii' codec can't encode character u'\xe0' in position 6: ordinal not in range(128) I've told mako I'm using unicode in any possible way: mylookup = TemplateLookup( directories=['plugins/stl/templates'], input_encoding='utf-8', output_encoding='...

Windows XP GTK App Glib Import Error

Hello, I am trying to run my GTK app on Windows XP and I am having troubles with an import. I have installed the following as needed and recommended: python-2.6.msi gtk2-runtime.2-16.6.exe pycairo-1.8.6.exe pygobject-2.20.0 pygtk-2.16.0.exe pyserial-2.5.exe However, I am getting the following error when running my script: Tracebac...