python

login_form_seq ? in python

Hello everyone ,,, can some one give me example and explain how to use login_form_seq in python and login_form_data .. and this simple example but i don't know really how to deal with that !! login_form_seq = [ ('log', sys.argv[2]), ('pwd', word), ('rememberme', 'forever'), ('wp-submit', 'Login >>'), ('redirect_to', 'wp-admin/')] z=...

Properties file in python (similar to Java Properties)

Given the following format (.properties or .ini): propertyName1=propertyValue1 propertyName2=propertyValue2 ... propertyNameN=propertyValueN For Java there is the Properties class that offers functionality to parse / interact with the above format. Is there something similar in python's standard library (2.x) ? If not, what other al...

How to send an e-mail from a Python script that is being run on "Google App Engine"?

Hi All!!! How could I send an e-mail from my Python script that is being run on "Google App Engines" to one of my mail boxes? I am just a beginner and I have never tried sending a message from a Python script. I have found this script (IN THIS TUTORIAL): Here is the same script as a quote: import sys, smtplib fromaddr = raw_inp...

VLC Python EventManager callback type?

I'm having trouble attaching an event handler to tell when a song has finished playing when using the VLC Python bindings. The event_attach function is complaining about the callback type. def __init__(self): self.vlc = vlc.Instance() self.vlc_playlist = self.vlc.media_list_new() self.vlc_player = self.vlc.media_list_player_...

Are there any major performance differences between epoll and kqueue?

My development machine is a MacBook (which of course has kqueue). However, in production we're running Linux (which of course uses epoll). Obviously, to know the performance characteristics of my code I need to run it using epoll. That said, is performance that I see under kqueue a decent approximation of what I'll see with epoll? Or...

start python script as background process from within a python script

My python script needs to start a background process and then continue processing to completion without waiting for a return. The background script will process for some time and will not generate any screen output. There is no inter-process data required. I have tried using various methods subprocess, multiprocessing but am clearly m...

Help Defining Global Names

My Code: def A(): a = 'A' print a return def B(): print a + ' in B' return When B() is entered into the interpeter I get Traceback (most recent call last): File "<interactive input>", line 1, in <module> File "<module1>", line 9, in B NameError: global name 'a' is not defined How should I go about defi...

Is there a way to find the second longest word in a sentence in Python ?

Hello everyone, I got stuck on this idea: how do I get the second longest word in a sentence ? I'm going to use it for an exit route in my code where the longest word might fail a test. Any ideas ? Thanks in advance. ...

Handling Password Authentication over a Network

I'm writing a game which requires users to log in to their accounts in order to be able to play. What's the best way of transmitting passwords from client to server and storing them? I'm using Python and Twisted, if that's of any relevance. ...

How can I turn a list of words in a text file into a regex to filter out?

I'm trying to filter out some text for certain keywords that are found in a text file. I was thinking about just parsing the file line by line, take each word and then merge them together with a pipe "|" then using that string inside re.sub. Any better more efficient ideas are welcome. ...

How to put 2 lists into 1 Dictionary in Python?

So this is the situation: I have 2 lists and want to put them in a dictionary. Content ['This is Sams Content', 'This is someone's else content'] Author ['Sam', 'Someone Else'] This is the dictionary I would like to create Reviews [{'content': 'This is Sams Content', 'author' : 'Sam'} , {'content': 'This is someone's else content', ...

How to make this random text generator more efficient in Python ?

Hello everyone, I'm working on a random text generator -without using Markov chains- and currently it works without too many problems. Firstly, here is my code flow: Enter a sentence as input -this is called trigger string, is assigned to a variable- Get longest word in trigger string Search all Project Gutenberg database for sentences...

Good way to Django-based website, installing prerequisites if needed

Consider a website build using python and django. In many cases it uses 3rd party modules beside standard python library - such as pytz, South, timezones or debug toolbar. What is standard or just convenient way to deploy such application to production hosting with all the prerequisites (timezones, etc) installed automatically? I'm new...

Problem building a list of class objects in python

Hi there - I'm still new to python, and been stuck playing around with this for a while and would appreciate someone pointing out where I'm going wrong. Basically I am trying to build a list that contains a number of different objects, with each object having several attributes. My attempt is simplified and shown below, basically I b...

Place a Button in ListCtrl - wxPython

Is is possible to place a button inside of a ListCtrl item with wxPython? Right now I have a ListCtrl that has data with a file name and size, and I want the user to be able to click a button, to download the file. If this isn't possible, is there a way to display an image in the ListCtrl, and then make it clickable so that I can bind an...

Does MongoDB have a Ruby Shell or Python Shell in addition to the Javascript shell?

Or, does using Ruby's irb and then require 'mongo' and adding some Connect statement essentially act like a Ruby shell... it would be great if a Ruby shell can be possible which as convenient as the Javascript Shell. ...

Running multiple instances of a python program efficiently & economically?

I wrote a program that calls a function with the following prototype: def Process(n): # the function uses data that is stored as binary files on the hard drive and # -- based on the value of 'n' -- scans it using functions from numpy & cython. # the function creates new binary files and saves the results of the scan in...

Getting pixel color in Windows, using python.

Possible Duplicate: Color picking from given coordinates Is it possible to get the current RGB tuple of a given pixel? Pseudo Code: print getpixelcolor(100,100) Which would return something like (35,42,245) ...

python web service for massive usage

I need to develp a real production webservice with python that will be used by another client application (with another progamming language ) . I mean in real production webservice that this webserivce is will be used on critical environment that failure of the webserivce could cause major problems. could someone provide /suggest which ...

what python package for rsa algorithm

hey crypto experts, looking to do RSA encryption on a short string in python. This is for a piece of user data that I want to store without staff (incl myself) being able to see it. The private key will be on a thumbdrive in my safety deposit box for when we get subpoenaed. my question: is there a 'probably correct' python package for ...