python

Where can I find good tutorials and guides on wxPython and wxGlade?

Just out of curiosity, aside from their respective sites, have any of you guys found a better resource for figuring out wxPython/wxGlade? I figured I'd ask while I'm chewing on something else, I plan on using those tools to create a GUI for the project I've started. ...

Why does my python script randomly get killed?

Basically, i have a list of 30,000 URLs. The script goes through the URLs and downloads them (with a 3 second delay in between). And then it stores the HTML in a database. And it loops and loops... Why does it randomly get "Killed."? I didn't touch anything. Edit: this happens on 3 of my linux machines. The machines are on a Rackspac...

How can I run redemo.py (or equivalent) on a Mac?

In the python installation on my PC there is a sweet script in c:\python26\tools\scripts called redemo.py. It's a simple tk app for testing regular expressions. I wish I could get it--or something like it--running on my Mac, but I don't know how. The script doesn't appear to be part of the python installation on my mac. Ideas? ...

What is the best language for sockets programming?

I'd like to develop software program that communicates between clients. What is the best programming language to do this? ...

Does my code leak memory (python)?

links_list = char.getLinks(words) for source_url in links_list: try: print 'Downloading URL: ' + source_url urldict = hash_url(source_url) source_url_short = urldict['url_short'] source_url_hash = urldict['url_short_hash'] if Url.objects.filter(source_url_short =...

Processing (possibly) optional arguments in Python

I am working on a series of command line tools which connect to the same server and do related but different things. I'd like users to be able to have a single configuration file where they can place common arguments such as connection information that can be shared across all the tools. Ideally, I'd like something that does the follow...

python GTK container for mjpeg stream

I have an mjpeg stream from a web-cam and would like to display it in an application written in python using pygtk. The stream is a string of bytes from the driver. What widget would be best for displaying this and would I need to do some intermediate conversion before putting it in the widget? Should I write my own widget to do this? ...

How to pass this command to subprocess.call?

Command: root@host:~#convert source.jpg -resize x500 -resize "500x<" -gravity center +repage target.jpg Python code: >> command_list = ['convert', 'source.jpg', '-resize', 'x500', '-resize', '\'500x<\'', '-gravity', 'center', 'target.jpg'] >> p = subprocess.call(command_list) convert: invalid argument for option `'500x<'': -resize. ...

running an outside program (executable) in python?

Hello all, I just started working on python and I have been trying to run an outside executable form python. I have an executable for a program written in Fortran. Lets say the name for the executable is flow.exe. And my executable is lacated in C:\Documents and Settings\flow_model I tried both os.system and popen commands but so far cou...

How do you install pycairo on Mac OS X?

This is the first time I've ever touched python, I'm trying to use a library 'cairo', but have been unable to import it getting the message Python 2.6.4 (r264:75821M, Oct 27 2009, 19:48:32) [GCC 4.0.1 (Apple Inc. build 5493)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import cairo Traceback (mo...

I want to develop a framework in Python for desktop based applications. How should I go about it?

I want to develop a desktop application framework in Python, much like QT, but how to go about it? Any tutorials or links related to it would be helpful! ...

Is it possible to unpack a tuple without using variables?

I'm using the os.path.split() function on a path in my program to get the filename and pathname of a file then passing them into another method, but my current solution seems rather ugly: path = os.path.split(somefile) some_class(path[0], path[1]) Is it possible to unpack the path tuple in a cleaner way within the call to some_class? ...

How to safely write to a file?

Imagine you have a library for working with some sort of XML file or configuration file. The library reads the whole file into memory and provides methods for editing the content. When you are done manipulating the content you can call a write to save the content back to file. The question is how to do this in a safe way. Overwriting th...

New Satchmo page is missing some store settings

If I add a new template and view to a satchmo install within my project it renders just fine, but it seems to be missing some values like the name of the store and it does not register that I am logged into the site when I am on the new pages. If I check the request.user it appears to be authenticated, but base.html does not render the ...

Python MySQL: clean multiple foreign keys table

Hi Everybody, I am working with Python MySQL, and need to clean a table in my database that has 13328 rows. I can not make a simple drop table, because this table is child and also father of other child foreign-keys linked on it. If I try drop table, the system forbidden me. The table is defined with ON UPDATE CASCADE, ON DELETE CASCAD...

Help ctypes.windll.dnsapi.DnsQuery_A

Hi, I have trouble with DnsQuery API, the *ppQueryResultsSet parameter troubles me. Can anyone show me an example of how to make correct DLL calls in python? import ctypes from ctypes import wintypes from windns_types import DNS_RECORD, IP4_ARRAY #declared here http://pastebin.com/f39d8b997 def DnsQuery(host, type, server, opt=0): ...

Replacing elements with lxml.html

Hello, I'm fairly new to lxml and HTML Parsers as a whole. I was wondering if there is a way to replace an element within a tree with another element... For example I have: body = """<code> def function(arg): print arg </code> Blah blah blah <code> int main() { return 0; } </code> """ doc = lxml.html.fromstring(body) codeblocks = do...

What should i use for a Remote Desktop Control?

Hi everybody i'm new to stackoverflow and to python programming :-) Can somebody point me in the right direction or suggest me a good way to do this..? The software I'd like to write is a kind of "multiple remote control", it has: One Server ... whose task is to send his screen to all the clients Many Clients ... they show the Serv...

How to delete Firefox cookies from webdriver in python?

Hello, when I can't delete FF cookies from webdriver. When I use the .delete_all_cookies method, it returns None. And when I try to get_cookies, I get the following error: webdriver_common.exceptions.ErrorInResponseException: Error occurred when processing packet:Content-Length: 120 {"elementId": "null", "context": "{9b44672f-d547-43a8-...

Making a Python script Object-Oriented

I'm writing an application in Python that is going to have a lot of different functions, so logically I thought it would be best to split up my script into different modules. Currently my script reads in a text file that contains code which has been converted into tokens and spellings. The script then reconstructs the code into a string,...