python

What's the best SOAP client library for Python, and where is the documentation for it?

I've never used SOAP before and I'm sort of new to Python. I'm doing this to get myself acquainted with both technologies. I've installed SOAPlib and I've tried to read their Client documentation, but I don't understand it too well. Is there anything else I can look into which is more suited for being a SOAP Client library for Python?...

variables as parameters in field options

I want to create a model, that will set editable=False on creation, and editable=True on editing item. I thought it should be something like this: home = models.ForeignKey(Team, editable=lambda self: True if self.id else False) But it doesn't work. Maybe something with overriding the init can help me, but i don't sure what can do th...

Why do attribute references act like this with Python inheritance?

The following seems strange.. Basically, the somedata attribute seems shared between all the classes that inherited from the_base_class. class the_base_class: somedata = {} somedata['was_false_in_base'] = False class subclassthing(the_base_class): def __init__(self): print self.somedata first = subclassthing(...

Ruby to Python bridge

Hello I am interested in getting some Python code talking to some Ruby code on Windows, Linux and possibly other platforms. Specificlly I would like to access classes in Ruby from Python and call their methods, access their data, create new instances and so on. An obvious way to do this is via something like XML-RPC or maybe CORBA but ...

Scrape a dynamic website

What is the best method to scrape a dynamic website where most of the content is generated by what appears to be ajax requests? I have previous experience with a Mechanize, BeautifulSoup, and python combo, but I am up for something new. --Edit-- For more detail: I'm trying to scrape the CNN primary database. There is a wealth of infor...

Help with <key> event in python Entry widget

Hey, I'm writing some code in python and I'm having trouble when trying to retrieve content of an Entry widget. The thing is: I want to limit the characters that can be typed, so I'm trying to clear the Entry widget when I reach the specific number of characters (2 in this case), but it looks like I always miss the last typed character....

Python: Difference between class and instance attributes

Is there any meaningful distinction between: class A(object): foo = 5 # some default value vs. class B(object): def __init__(self, foo=5): self.foo = foo If you're creating a lot of instances, is there any difference in performance or space requirements for the two styles? When you read the code, do you consider t...

Hooking up GUI interface with asynchronous (s)ftp operation

Trying to implement a progress dialog window for file uploads that look like a cross between IE download dialog and Firefox download dialog with a python GUI library on Windows. What asynchronous (S)FTP libraries are there for python? Ideally I should be able to do file upload resumes and track the progress of each parallel file upload...

List of IP addresses/hostnames from local network in Python

How can I get a list of the IP addresses or host names from a local network easily in Python? It would be best if it was multi-platform, but it needs to work on Mac OS X first, then others follow. Edit: By local I mean all active addresses within a local network, such as 192.168.xxx.xxx. So, if the IP address of my computer (within th...

extracting a parenthesized Python expression from a string

I've been wondering about how hard it would be to write some Python code to search a string for the index of a substring of the form ${expr}, for example, where expr is meant to be a Python expression or something resembling one. Given such a thing, one could easily imagine going on to check the expression's syntax with compile(), evalu...

Why did you start using Python?

Why did you start using Python? I was using Perl for my programming needs, and was often frustrated. I hated reading other people's Perl code and basically would often result to re-writting entire functions rather than trying to debug someone else's code. Also, coming back to code I'd written months before was a headache. (admittidl...

Python tutorial for total beginners?

I've recently been given a group of five 16/17 year old students to mentor through a extra-curricular software project. The only trouble is, they have never done any form of coding / scripting. This in itself makes me feel nervous. After much agonising I settled on getting them to use Python as its free and there appears to be a lot of u...

Are there any IDE's that support Python 3 syntax?

I recently saw an announcement and article outlining the release of the first Python 3.0 release candidate. I was wondering whether there were any commercial, free, open source etc. IDE's that support its syntax. ...

Is there a free python debugger that has watchpoints?

pdb and winpdb both seem to be missing this essential (to me) feature. I saw something suggesting WingIDE has it but I'd prefer a solution that is free, and if I do have to pay, I'd prefer to pay for something that is better than Wing. ...

Python module that implements ftps

Hi People, I was wondering if anybody could point me towards a free ftps module for python. I am a complete newbie to python, but this is something I need for a work project. I need an ftps client to connect to a 3rd party ftps server. thanks, David. ...

How to enable MySQL client auto re-connect with MySQLdb?

I came across PHP way of doing the trick: my_bool reconnect = 1; mysql_options(&mysql, MYSQL_OPT_RECONNECT, &reconnect); but no luck with MySQLdb (python-mysql). Can anybody please give a clue? Thanks. ...

How to make Apache/mod_python process collect its zombies?

Apache/2.2.6 (Unix) DAV/2 mod_python/3.2.8 Python/2.4.4 configured ... One of apache processes spawns some long-running python script asynchronously, and apparently doesn't seem to collect its child process table entry. After that long-run-in-subprocess python script finishes - defunct python process has been left. # ps -ef | grep htt...

how to read and write multiple files

I want to write a program for this: in a folder I have n number of files; first read one file and perform some operation then store result in a separate file and the read 2nd file again perform operation and save result in new 2nd file, even same procedure n number of files. The program read all files one by one and stores results of eac...

How to base64 encode a PDF file in Python

How should I base64 encode a PDF file for transport over XML-RPC in Python? ...

Why do I receive an ImportError when running one of the CherryPy tutorials

I have installed CherryPy 3.1.0,. Here is what happens when I try to run tutorial 9: $ cd /Library/Python/2.5/site-packages/cherrypy/tutorial/ $ python tut09_files.py Traceback (most recent call last): File "tut09_files.py", line 48, in <module> from cherrypy.lib import static ImportError: cannot import name stat...