python

what's with a "embedded webserver in a web application" in Python?

CherryPy claims: Your CherryPy powered web applications are in fact stand-alone Python applications embedding their own multi-threaded web server. You can deploy them anywhere you can run Python applications. Apache is not required, but it's possible to run a CherryPy application behind it (or lighttpd, or IIS). Cherr...

Unit testing infrastructure for a python module

Hi there, I'm writing a python module and I would like to unit test it. I am new to python and somewhat bamboozled by the options available. Currently, I would like to write my tests as doctests as I like the declarative rather than imperative style (however, feel free to disabuse me of this preference if it is misinformed). This rai...

Django unable to find MySQLdb python module

Installed Django from source (python setup.py install and such), installed MySQLdb from source (python setup.py build, python setup.py install). Using Python 2.4 which came installed on the OS (CentOS 5.5). Getting the following error message after launching the server: Error loading MySQLdb module: No module named MySQLdb The pythonpa...

How to remove special characters and letters from a line read from a text file in Python?

How can I remove special characters and letters from a line read from a text file while preserving the whitespaces? Let's say we have the following contents in a file: 16 ` C38# 26535 2010 4 14 2 7 7 3 8^@1 2 15 100 140 30 $ 14^] (2003 2 ! -6 �021 0 � 14 ! 2 3! 1 0 35454 ...

Limiting Acess to django admin via applicatins

Is it possible to limit what admin pages a user is able to VIEW and modify i know it is currently possible to limit changes to them, but is it possibly to limit a user via permissions or otherwise to only the administration views for one app. If possibly i am also aiming that superusers can access the standard django admin Looking aroun...

Continuing my programming education

I completed Stanford's CS106a over the summer and took the ap exam in java a few months ago. As a result I have a pretty good knowledge of java. Now I want to continue my programming education. Several things have been recommended to me. Learn Python (I already have a python book or two lying around) Learn by programming and building p...

python twisted threading

Hi can you please tell me how use different functions in different thread using thread pool in twisted...say I have a list of ids x=[1,2,3,4] where 1,2,...etc are ids(I got from data base and each one contains python script in some where disk). what I want to do is scanning of x traverse on list and run every script in different thre...

Seeing what gets written to stderr in Python web site using FastCGI

I am working on a website, hosted on DreamHost, using Python. For a while, I was using their default setup, which runs Python scripts using CGI. It worked fine, but I was worried that if I get a lot of traffic, it would run slow and use a lot of memory, so I switched it over to FastCGI using this module. Overall, it still works fine, bu...

wxPython: Context help

In Windows dialog boxes, sometimes there is a small ? button on the upper right corner. Its usage is to click on the ?, then the cursor changes to an arrow with a ?, then click on widget inside the dialog box, which will then display a popup help balloon. This is how my class definition looks like: class Frame(wx.Frame): def __init__...

Learn a scripting language besides Python

Someone told me once, that programmers tend to learn one scripting language properly and ignore or dislike other scripting languages. Do you have similar experiences? I'm using Python as my choice for scripting for few years, however, I'm sure that there are many existing and emerging languages that could impress the Pythonistas. Can y...

How can I go about securely executing a subset of python?

I need to store source code for a basic function in a database and allow it to be modified through an admin interface. this code will take several numbers and strings as parameters, and return a number or None. I know that eval is evil, so I need to implement a safe way to execute a very basic subset of python, or something syntactical...

How to build pyobjc from src

I am trying to build pyobjc from src, so I checked out http://svn.red-bean.com/pyobjc/trunk but I have no clue after that what I do to build it, I do not see any make or setup files? Edit 1: I tried setup.py in trunk/pyobjc/pyobjc folder but it tries to download all the required modules which seem to be already in trunk/pyobjc e.g. it ...

Stop invoking of new Shell/cmd prompt , python

hi friends., i have a python script which should invoke a .exe file to get some result. That .exe file is invoking a new windows command prompt(shell) . i dont need any output from the .exe file. i 'm using os.system('segwin.exe args') in my script where segwin is an executable. now my question is : i need to stop invoking cmd prompt...

wxPython with wxFormBuilder - How to use wx.EVT_IDLE

Hi, I can't seem to bind the EVT_IDLE to my OnIdle function. I created a form using the wxFormBuilder. It generates the python code in Form.py. I specfied for the TopFrame that the OnIdle event should be associated with TopFrameOnIdle (actually, it generates that name automatically when double clicking OnIdle in Events tab). When I tr...

Can i put java files in a folder in a pydev project?

Hi guys, I have a .java and .class file which i put under a folder inside my pydev project in Eclipse (because im primarily using python). Inside my python script i wanted to call the java class file using os.system. os.system('java -mx1500m D:\\projects\\socialsense\\src\\ss\\samplefile\\test') However it says that my class file is...

wxPython validator not called for grandchild of dialogue

I have something like this: class ADialog(wx.Dialog): def __init__(self, parent, *args, **kwargs): ... self.editor = APanel(parent=self) ... ... class APanel(wx.Panel): def CreatePanel(self, *args, **kwargs): ... self.textCtrls = [] for (key, val) in zip(foo, bar): ...

outlook PST File extracting via libpst + python

Hello , had anyone successfully import and used libpst via python, to extract outlook PST files : http://www.five-ten-sg.com/libpst/ from source package? It have python bindings but i cannot import after installing (even test.py script comes with it dont work) Here is Mercurial repo to latest version. Can you guys give a try? i need he...

No more BeautifulSoup

Hi there.. I have been using BeautifulSoup but as I understand it that library is no longer being maintained. So what should I use ? I have heard about Xpath but what else is there ? ...

python opencv: no image

Hi all, I am trying to capture from a Sony Handicam DCR-HC38, running the code below, and passing [-1 .. 3] to the CaptureFromCAM function. The code runs, but I get no image. Do I need to "wrap" the camera somehow? Skype recognizes the camera, but python/opencv won't. I'm running Windows Vista if that helps any. import cv cv.Named...

How to create logic bricks programmatically in Blender?

I would like to let my initializing script to create additional sensors/controller/actuators necessary for an interactive Blender application (not necessarily a game). This is preferable for two reasons: I can use this script in multiple applications. Creating common logic over and over again is tedious. And there is no other way to im...