python

Is it safe to use ComputedProperty?

I need support for computed properties in App Engine. I downloaded the latest source release to try and implement them myself. Whilst going through code, I came across a property class that already seems to do exactly what I need. class ComputedProperty(Property): """Property used for creating properties derived from other values. ...

Client Server Socket Programing in Python

Hi, I have the Client Server Socket program on python. In both the Client and Server I use the loopback address. But kindly assist how to use this code and apply on different Client Server machines Eg (Server IP 192.168.1.4 & Client IP 192.168.1.5) # Server program from socket import * host = "localhost" port = 21567 buf = 1024 addr...

MVP: Presenter-Model communication

Hey there, I have a design question about the communication between the model and the presenter in the MVP design pattern -- or more accurately its derived form the passive view. Let's assume the following simple GUI as an example: I have a window where my view is a list and there is the possibility to open a file dialog to select a fi...

How to 3DES encrypt in Python using the M2Crypto wrapper?

I have a working test of a hardware device that uses RSA encryption, in Python using M2Crypto. Now I need to test a similar device that uses 3DES encryption. But I can't figure out how to use M2Crypto to do triple DES encryption. I know it should be possible from this chart. But unfortunately the documentation of M2Crypto I've found ...

WScript.Shell Run always on top option

Hi, I would like to execute WScript.Shell command using Run and set it to be always on top. As far I figured out how to make Popup always on top. import win32api, win32com.client shell = win32com.client.Dispatch('WScript.Shell') shell.Popup('Message', 0, 'Title', 4096) win32api.Sleep(100) Is there a way to do the same thing with Run...

python regular expresssion for a string

consider this string prison break: proof of innocence (2006) {abduction (#1.10)} i just want to know whether there is (# floating point value )} in the string or not i tried few regular expressions like re.search('\(\#+\f+\)\}',xyz) and re.search('\(\#+(\d\.\d)+\)\}',xyz) nothing worked though...can someone suggest me someth...

How to "hide" curse words in a py file?

I'm a school teacher who spent the summer writing a vocab training program in python that uses text available from wikipedia and gutenberg. Now all I have to do is figure out a way to filter out curse words so that I can distribute to students. Normally I would just have an array (list) of those curse words and do a simple filter. The p...

Create launchable GUI script from Python setuptools (without console window!)

The way I currently add an executable for my Python-based GUI is this: setup( # ... entry_points = {"gui_scripts" : ['frontend = myfrontendmodule.launcher:main']}, # ... ) On Windows, this will create "frontend.exe" and "frontend-script.pyw" in Python's scripts folder (using Python 2.6). When I execute the EXE ...

Turning jQuery charts into PDFs

I've found two jQuery charts plugins I like - flot and jqPlot. I'm thinking of using one of these on the front-end of my web site. However, I also need to be able to allow users to export data in PDF format. I'm ideally looking for a pure Python solution, but could run to Java or PHP at a push. The quality of the generated charts is the...

Pitfalls of number values in Python, "How deep?"

I'm a fairly green programmer, and I'm learning Python right now. I'm up to chapter 17 in "Learn to Think Like a Computer Scientist" (Classes and Methods), and I just wrote my first doctest that failed in a way I truly do not fully understand: class Point(object): ''' represents a point object. attributes: x, y ''' ...

Most Comprehensive Python SVG Library

I'd like to generate SVG images (e.g. general artwork, not just charts or graphs) using Python. What's the best Python SVG library that supports broadest range of SVG's feature set? ...

Python: using ctypes

Hi: I need to use Dll from python using ctypes but I read the tutorial and I don´t understand anything!! I wants to load the dll from path and access to its functions... SOS!! Thanks ...

windows/python manipulate versioninfo during runtime

I have multiple python processes running in their console output windows. I can set their console title via win32api.SetConsoleTitle(). Thats nice, but it would be even nicer to set some versioninfo strings (like description/company name/version) during runtime as that would allow me to easier differentiate between the (generic) python p...

Store user defined data after inputted

I am making a python program, and I want to check if it is the users first time running the program (firstTime == True). After its ran however, I want to permanently change firstTime to False. (There are other variables that I want to take input for that will stay if it is the first run, but that should be solved the same way). Is there...

Variable interpolation in Python

Possible Duplicate: Unpythonic way of printing variables in Python? In PHP one can write: $fruit = 'Pear'; print("Hey, $fruit!"); But in Python it's: fruit = 'Pear' print("Hey, {0}!".format(fruit)) Is there a way for me to interpolate variables in strings instead? And if not, how is this more pythonic? Bonus points for ...

Django and FeinCMS: A way to use the Media Library in other normal models?

I'm using Django and FeinCMS on a project. I'm currently using FeinCMS for all the pages on the site. But I also have another separate model that handles very simple stock for the site too. This stock model has the usual fields (name, description, etc) but I also want it to have photos. Because FeinCMS has a media library already, I wou...

how to input n numbers in list one by one?

i want my python code to ask value of n,after user inputs the value. program takes input for n values,and stores it in a list or something like array(in c). input must be in the format: enter value of n:4 2 5 7 1 i want to store this input in list, for my later use. hope it's more clear now. since i m new to python i am explaining m...

What's this text encoding ?

Hi, I used Python's imaplib to pull mail from a gmail account... but I got an email with this confusing text body: > RGF0ZSBldCBoZXVyZTogICAgICAgICAgICAgICAgICAgICAgICAgICAyMi8wOC8yMDEwIDE0 > OjMzOjAzIEdNVCBVbmtub3duDQpQcsOpbm9tOiAgICAgICAgICAgICAgICAgICAgICAgICAg > ICAgICAgICAgamFjaW50bw0KTm9tOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgI...

Clear a TableView in PyQt

Hello there, I'm in the process of learning how to display data and tables using PyQt. Ultimately I'd like to have a Table showing the contents of a database, but for now I'm just getting to grips with some of the fundamentals. I have a basic setup (pasted below) made using Qt Designer with a set of buttons ("Create", "Add Row", "Add Co...

Python, opposite function urllib.urlencode

Hello, how i can covert data after processing urllib.urlencode to dict ? urllib.urldecode does not exist. Sorry for my English. ...