python

Restarting a Django application running on Apache + mod_python

I'm running a Django app on Apache + mod_python. When I make some changes to the code, sometimes they have effect immediately, other times they don't, until I restart Apache. However I don't really want to do that since it's a production server running other stuff too. Is there some other way to force that? Just to make it clear, since ...

SharePoint via SOAP using Python

I have been following the solution noted here - as this is exactly what I need to achieve; http://stackoverflow.com/questions/218987/how-can-i-use-sharepoint-via-soap-from-python however when I run one of the last lines of this code I get the following error; >>> client = SoapClient(url, {'opener' : opener}) Traceback (most recent ca...

Deploying a Web.py application with WSGI, several servers

I've created a web.py application, and now that it is ready to be deployed, I want to run in not on web.py's built-in webserver. I want to be able to run it on different webservers, Apache or IIS, without having to change my application code. This is where WSGI is supposed to come in, if I understand it correctly. However, I don't unders...

wxPython menu doesn't display image

I am creating a menu and assigning images to menu items, sometime first item in menu doesn't display any image, I am not able to find the reason. I have tried to make a simple stand alone example and below is the code which does demonstrates the problem on my machine. I am using windows XP, wx 2.8.7.1 (msw-unicode)' import wx def getBm...

Advanced SAX Parser in C#.

See Below is the XML Arch. I want to display it in row / column wize. What I need is I need to convert this xml file to Hashtable like, {"form" : {"attrs" : { "string" : " Partners" } {"child1": { "group" : { "attrs" : { "col" : "6", "colspan":"1" } } { "child1": { "field" : { "attrs" : { "nam...

I'd like to call the Windows C++ function WinHttpGetProxyForUrl from Python - can this be done?

Microsoft provides a method as part of WinHTTP which allows a user to determine which Proxy ought to be used for any given URL. It's called WinHttpGetProxyForUrl. Unfortunately I'm programming in python so I cannot directly access this function - I can use Win32COM to call any Microsoft service with a COM interface. So is there any way...

How to put Google login box inside flash in GAE ?

Hi, I am putting my old flash site into GAE. I want to use Google's user authentication too. Now, I want to put Googles login box inside the flash instead of redirecting to Google's login page. Same thing I want for forgot password. Is it possible to do this? How to do this? ...

How to make these dynamically typed functions type-safe?

Is there any programming language (or type system) in which you could express the following Python-functions in a statically typed and type-safe way (without having to use casts, runtime-checks etc)? #1: # My function - What would its type be? def Apply(x): return x(x) # Example usage print Apply(lambda _: 42) #2: white = None...

a sortable list/grid control in boa constructor

In my project there's a need for a multi-column list control. I wish the list could be automatically sorted upon clicking on the column header. Since i'm using Boa constructor, the solution should not be too obtrusive, i.e. compatible with Boa's ability to read and regenerate the code. So I thought, there can be either a built-in cont...

How to emulate language complement operator in .hgignore?

I have a Python regular expression that matches a set of filenames. How to change it so that I can use it in Mercurial's .hgignore file to ignore files that do not match the expression? Full story: I have a big source tree with *.ml files scattered everywhere. I want to put them into a new repository. There are other, less important fil...

Sphinx templating

I am using sphinx. I want to template it. So after reading the docs, what I am trying is, in my conf.py, I put a line like, templates_path = ['_templates'] and I created a file _templates/page.html But this does not override the default template provided by sphinx. What more should I do, and where does this template need to go? ...

What's the correct way to use win32inet.WinHttpGetProxyForUrl

I'm trying to use a feature of the Microsoft WinHttp library that has been exposed by the developers of Win32com. Unfortunately most of the library does not seem to be documented and there are no example of the correct way to use the win32inet features via the win32com library. This is what I have so far: import win32inet hinternet = w...

Preventing invoking C types from Python

What's the correct way to prevent invoking (creating an instance of) a C type from Python? I've considered providing a tp_init that raises an exception, but as I understand it that would still allow __new__ to be called directly on the type. A C function returns instances of this type -- that's the only way instances of this type are i...

How do you extract a JAR in a UNIX filesystem with a single command and specify its target directory using the JAR command?

I am creating a Python script within which I am executing UNIX system commands. I have a war archive named Binaries.war which is within an ear archive named Portal.ear The Portal ear file resides in, say /home/foo/bar/ jar xf /home/foo/bar/Portal.ear Binaries.war Will extract the Binaries.war file out of the /home/foo/bar/Portal.ear ...

Why do pythonistas call the current reference "self" and not "this"?

Python is the language I know the most, and strangely I still don't know why I'm typing "self" and not "this" like in Java or PHP. I know that Python is older than Java, but I can't figure out where does this come from. Especially since you can use any name instead of "self" : the program will work fine. So where does this convention ...

Is there a map without result in python?

Sometimes, I just want to execute a function for a list of entries -- eg.: for x in wowList: installWow(x, 'installed by me') Sometimes I need this stuff for module initialization, so I don't want to have a footprint like x in global namespace. One solution would be to just use map together with lambda: map(lambda x: installWow(x,...

Would Like Open Source RSS / News Reader Code or Widget Python or Javascript

I would like to be able to massage certain categories of news feeds to make their entries more consistent. For example, when a job seeker subscribes to two different job sites the feeds s/he gets will differ markedly. One would like to be able to perform lookups and other work in the news reader, process the incoming feed on the basis of...

Handling authentication and proxy servers with httplib2

I'm attempting to test interactions with a Nexus server that requires authentication for the operations I intend to use, but I also need to handle an internal proxy server. Based on my (limited) understanding I can add multiple handlers to the opener. However I'm still getting a 401 response. I've checked the username and password are v...

Cleaning an image to only black

I have an image. I would like to go over that image, pixel by pixel, and any pixel that is not black should be turned to white. How do I do this? (Python). Thanks! ...

Random list with rules

I'm trying to create a list of tasks that I've read from some text files and put them into lists. I want to create a master list of what I'm going to do through the day however I've got a few rules for this. One list has separate daily tasks that don't depend on the order they are completed. I call this list 'daily'. I've got anoth...