python

What framework is trac based on?

I just downloaded this tracking system and curious what framework this great system uses? ...

Errno socket error in python

i wrote this code : import random import sys import urllib openfile = open(sys.argv[1]).readlines() c = random.choice(openfile) i = 0 while i < 5: i=i+1 c = random.choice(openfile) proxies = {'http': c} opener = urllib.FancyURLopener(proxies).open("http://whatismyip.com.au/").read() ::: I put 3 proxy in a txt file . : http://211...

finding a solution to a giving maze txt.file

how can i fix this program, the problem is when it print out the coordinate it give me a 7 for the start and finish, i would appreciated you help, thanks start = (len(data)) finish = (len(data)) pos= [] for i in range(len(pos)): for j in range(len(pos[i])): if pos[i][j] == "S": start=(i,j) elif pos[i][...

Return value from wxPython Frame

Hi, Could someone show me how I could return a value from a wxPython Frame? When the use clicks close, I popup a message dialog asking him a question. I would like to return the return code of this message dialog to my calling function. Thanks ...

Creating collaborative whiteboard drawing application

I have my own drawing program in place, with a variety of "drawing tools" such as Pen, Eraser, Rectangle, Circle, Select, Text etc. It's made with Python and wxPython. Each tool mentioned above is a class, which all have polymorphic methods, such as left_down(), mouse_motion(), hit_test() etc. The program manages a list of all drawn sha...

functional correctness of wiki mersenne twister psuedocode

can anyone tell me if the mersenne twister psuedocode on this page is the same as the code here? if they are not the same, which one is correct? ...

Check if NFS share is mounted in python script

I wrote a python script that depends on a certain NFS share to be available. If the NFS share is not mounted it will happily copy the files to the local path where it should be mounted, but fail later when it tries to copy some files back that were created on the NFS server. I'd like to catch this error specifically so I can print a us...

How to verify object creation in Django?

I want to verify that the object I created was really created, and return True or False according to that: obj = object(name='plop') try: obj.save() return True except ???: return False How can object creation be verified? ...

Launch an SWF full screen

I have a swf file (a flash game). I want to run some script to open it in full-screen mode. I'm not attached to any browser, but I do run Linux, so a bash, or generic answer is what I'm looking for. I'm also open to building a lite browser application if need-be. ...

Python: How can I subclass a class I'm nesting in?

I am trying to do the following in a bit of python code: class Parent: class Child(Parent): pass And it does not work. Is there any python syntax I can use to achieve the same result? Thanks. ...

How to extract comment out of header file using python, perl, or sed?

I have a header file like this: /* * APP 180-2 ALG-254/258/772 implementation * Last update: 03/01/2006 * Issue date: 08/22/2004 * * Copyright (C) 2006 Somebody's Name here * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following con...

How to force PyYAML to load strings as unicode objects?

The PyYAML package loads unmarked strings as either unicode or str objects, depending on their content. I would like to use unicode objects throughout my program (and, unfortunately, can't switch to Python 3 just yet). Is there an easy way to force PyYAML to always strings load unicode objects? I do not want to clutter my YAML with !!p...

Load Pymacs & Ropemacs only when opening a Python file ?

I use Pymacs to load Ropemacs and Rope with the following lines in my .emacs as described here. (autoload 'pymacs-load "pymacs" nil t) (pymacs-load "ropemacs" "rope-") It however slows down the startup of Emacs significantly as it takes a while to load Ropemacs. I tried the following line instead but that loads Ropemacs everytime Py...

In Ruby or Python can the very idea of Class be rewritten?

Howdy All... first time at stack overflow. I'm looking into using some of the metaprogramming features provided by Ruby or Python, but first I need to know the extent to which they will allow me to extend the language. The main thing I need to be able to do is to rewrite the concept of Class. This doesn't mean that I want to rewrite a...

How Can I: Generate 40/64 Bit WEP Key In Python?

So, I've been beating my head against the wall of this issue for several months now, partly because it's a side interest and partly because I suck at programming. I've searched and researched all across the web, but have not had any luck (except one small bit of success; see below), so I thought I might try asking the experts. What I am...

Number of lines in csv.DictReader

Hi there, I have a csv DictReader object (using Python 3.1), but I would like to know the number of lines/rows contained in the reader before I iterate through it. Something like as follows... myreader = csv.DictReader(open('myFile.csv', newline='')) totalrows = ? rowcount = 0 for row in myreader: rowcount +=1 print("Row %d/...

Is there really no binary distribution of MySQLdb for Windows?

You have to build it yourself? Or am I missing something. ...

How to generate graphs and statistics from SQLAlchemy tables [Python]?

Hi all, After running a bunch of simulations I'm going to be outputting the results into a table created using SQLAlchemy. I plan to use this data to generatw statistics - mean and variance being key. These, in turn, will be used to generate some graphs - histograms/line graphs, pie-charts and box-and-whisker plots specifically. I'm aw...

How to join two wav file using python??

I am using python programming language,I want to join to wav file one at the end of other wav file? I have a Question in the forum which suggest how to merge two wav file i.e add the contents of one wav file at certain offset,but i want to join two wav file at the end of each other... And also i had a prob playing the my own wav file,us...

psycopg2 can't find my python26 installation

I believe it's because I installed python using SciPy, so apparently it's not in the registry where the psycopg2 installer is looking. Anyway to fix this without installing python26 over the existing install? I'm not sure if that will corrupt it. EDIT: My PYTHONPATH looks like the following: 'C:\\Python26\\scripts', 'C:\\Python26\\lib\...