python

How to import XSD schema with Python Suds (version 0.3.6) SOAP library : TypeNotFound exception ?

I'm trying to use SABRE travel web services with Python Suds, but one XSD seems not well-formed (maybe namespace is missing in this schema). from suds.client import Client wsdl = 'http://webservices.sabre.com/wsdl/sabreXML1.0.00/tpf/OTA_AirPriceLLSRQ.wsdl' client = Client(wsdl, cache=None) Debug trace returns : .DEBUG:suds.wsdl:rea...

Compiling a py2app working build for both Leopard and Snow Leopard?

I currently am making my PyObjC application work for Snow Leopard and I successfully compiled a standalone app. My question would be, how do I make the build to be also Leopard-compatible, given these errors? dyld: lazy symbol binding failed: Symbol not found: _fopen$UNIX2003 Referenced from: /Applications/MyApp.app/Contents/MacOS/MyA...

What are some of the core conceptual differences between C# and Python?

Hi everyone, I'm new to Python, coming from a C# background and I'm trying to get up to speed. I understand that Python is dynamically typed, whereas C# is strongly-typed. -> see comments. What conceptual obstacles should I watch out for when attempting to learn Python? Are there concepts for which no analog exists in Python? How impor...

Object store for objects in Django between requests

I had the following idea: Say we have a webapp written using django which models some kind of bulletin board. This board has many threads but a few of them get the most posts/views per hour. The thread pages look a little different for each user, so you can't cache the rendered page as whole and caching only some parts of the rendered pa...

How to make custom buttons in wx?

I'd like to make a custom button in wxPython. Where should I start, how should I do it? ...

IBOutlet in Python

Hi all! Is there a way to use a Cocoa IBOutlet in Python? Or do I need to do this in ObjC? Thanks in advance. ...

How do you make a PDF searchable with text in the sidebar?

I'm looking to create some PDF's from Python. I've noticed that some pdf's have sidebar text that allows you to see the context of occurrences of search terms. e.g. search for "dictionary" View in Sidebar: Page 10 Assigning a value to an existing dictionary key simply replaces the old value with a new one. How is that done? Is the...

referencing class methods in class lists in Python

I am writing a class in Python 2.6.2 that contains a lookup table. Most cases are simple enough that the table contains data. Some of the cases are more complex and I want to be able call a function. However, I'm running into some trouble referencing the function. Here's some sample code: class a: lut = [1, 3, ...

How do I form a URL in Django for what I'm doing

Desperate, please help. Will work for food :) I want to be able to have pages at the following URLs, and I want to be able to look them up by their URL (ie, If somebody goes to a certain URL, I want to be able to check for a page there). mysite.com/somepage/somesubpage/somesubsubpage/ mysite.com/somepage/somesubpage/anothersubpage/ my...

suppress/redirect stderr when calling python webrowser

I have a python program that opens several urls in seperate tabs in a new browser window, however when I run the program from the command line and open the browser using webbrowser.open_new(url) The stderr from firefox prints to bash. Looking at the docs I can't seem to find a way to redirect or suppress them I have resorted to usin...

Why is Python's enumerate so slow?

Why is "enumerate" slower than "xrange + lst[i]"? >>> from timeit import Timer >>> lst = [1,2,3,0,1,2]*1000 >>> setup = 'from __main__ import lst' >>> s1 = """ for i in range(len(lst)): elem = lst[i] """ >>> s2 = """ for i in xrange(len(lst)): elem = lst[i] """ >>> s3 = """ for i, v in enumerate(lst): elem = v """ >>> t1 =...

Why does ActivePython exist?

What's ActivePython actually about? From what I've read it's just standard Python with openssl and pyWin32 (on Win). No big deal I guess, I could install them in matter of minutes, and most people don't need them anyway. All other mentioned libraries (zlib, bzip2, sqlite3, Tkinter, ElementTree, ctypes, multiprocessing) are part of core...

Is there any way to make an asynchronous function call from Python [Django]?

Srry for my English. I am creating some Django application, that does various long computations with uploaded files. I don't want make user wait for the file to be handled - i just want to show him some page like 'file is being parsed'. So, how can i make an asynchronous function call from a view? Something that may look like that: d...

Python script performance as a background process

Im in the process of writing a python script to act as a "glue" between an application and some external devices. The script itself is quite straight forward and has three distinct processes: Request data (from a socket connection, via UDP) Receive response (from a socket connection, via UDP) Process response and make data available to...

Optional get parameters in django?

Can someone please explain how you can write a url pattern and view that allows optional parameters? I've done this successfully, but I always break the url template tag. Here's what I have currently: Pattern (r'^so/(?P<required>\d+)/?(?P<optional>(.*))/?$', 'myapp.so') View def so(request, required, optional): If I use the url t...

Remove elements as you traverse a list in Python

In Java I can do by using an Iterator and then using the .remove() method of the iterator to remove the last element returned by the iterator, like this: import java.util.*; public class ConcurrentMod { public static void main(String[] args) { List<String> colors = new ArrayList<String>(Arrays.asList("red", "green", "blue",...

Nice copying from Python Interpreter

Hi all, When I am working with a Python Interpreter, I always find it a pain to try and copy code from it because it inserts all of these >>> and ... Is there a Python interpreter that will let me copy code, without having to deal with this? Or alternatively, is there a way to clean the output. Additionally, sometimes I would like to ...

Why is '#!/usr/bin/env python' supposedly more correct than just '#!/usr/bin/python' ?

Anyone know this? I've never been able to find an answer. ...

Multiprocessing debug techniques

I'm having trouble debugging a multi-process application (specifically using a process pool in python's multiprocessing module). I have an apparent deadlock and I do not know what is causing it. The stack trace is not sufficient to describe the issue, as it only displays code in the multiprocessing module. Are there any python tools, or...

RPC for multiprocessing, design issues

Hey everyone, what's a good way to do rpc across multiprocessing.Process'es ? I am also open to design advise on the following architecture: Process A * 10, Process B * 1. Each process A has to check with proces B on whether a particular item needs to be queried. So I was thinking of implementing multiprocessing.Pipe() object for all...