python

Xorg, Python, and Current Window Title

After stackoverflow answered my previous question on here about my Wiimote left/right click issue, Not only can I move the mouse cursor, I can now left/right click on things. I now have one more question. What do I use in python to get the title of the current active window? After googling 'X11 Python Window Title', 'Linux Python Window...

combine list elements

How can I merge/combine two or three elements of a list. For instance, if there are two elements, the list 'l' l = [(a,b,c,d,e),(1,2,3,4,5)] is merged into [(a,1),(b,2),(c,3),(d,4),(e,5)] however if there are three elements l = [(a,b,c,d,e),(1,2,3,4,5),(I,II,II,IV,V)] the list is converted into [(a,1,I),(b,2,II),(c,3,III),(d,...

How can I do two-stage authentication to an Active Directory server in Python?

I'm running Python 2.6 on a FreeBSD machine, and I would like to do (and I don't know the correct term for this) two-stage authentication against an active directory. Basically, the process to log in user 'myuserid' is: Bind to the AD LDAP server using a system account created for this purpose (call it DOMAIN\gatekeeper) Verify myuser...

Python to control macros in mutliple instances of Excel.

How Do control with python multiple instances of Excel. This is not read/write, but more running macros on different workbooks. Ex: Excel.exe running Book1.xls. has mac1 Excel.exe running Book2.xls. has mac2. I got one instance to work, this first instance, which use 2003. I could not figure out the other instance which is 2007. I...

Custom classes in python: does a method HAVE to be called with an instance?

I'm processing data from an application that has a few quirks in how it keeps time. One of the simpler quirks is that it uses "day of year" (Jan 1 is 1, Febuary 1 is 32, etc) instead of month + day. So I want to make my own date class that inherits from the default datetime class and has a few custom methods. I'm calling this daytime. In...

Python: Upload a photo to photobucket

Hi there, Can a Python script upload a photo to photo bucket and then retrieve the URL for it? Is so how? I did find one script www.democraticunderground.com/discuss/duboard.php?az=view_all address=240x677 But i just found that confusing. many thanks, Phil ...

How can I make a URL link in django that will go to the referring view?

I want to be able to create a back link to the referring URL, if the referrer was a view, and if it was not a view, a back link to a default page (Don't ask... it's kind of a weird requirement). Basically, if the user came to the page in question from another view on the same django site, the back link should be a return to that view. ...

Why are the python.org OS X installers built with gcc-4.0?

In answering SO question 3500638, Ned Deily states that the Apple-supplied Pythons (2.5.4 and 2.6.5) are both built with gcc-4.2. However, all three of the python.org OS X Pythons (2.6.5, 2.7, 3.1.2) are built using gcc-4.0. Questions Why are the python.org Pythons (2.6.5, 2.7, 3.1.2) built using gcc-4.0? What are the gotchas of usin...

python tkinter listbox: adding items

At program startup, I add some items to my listbox like this: for widget in WidgetNames: listbox.insert(0, widget) WidgetNames is obviously a list of some items, e.g. "Button" and "Canvas". The thing is, the listbox doesn't show the items that are added with above code. However, for widget in WidgetNames: listbox.insert(0, w...

Is there a python twitter search library that handle results the right way?

All the libraries I've tested search in twitter, let you specify the rpp (results per page) parameter but only gives you ONE page results. It'd be cool a Python lib that provide a generator and each time gen.next() is called, a new search result is yielded. If the page is over, jump to the next page alone. ...

Passing a password to KLOG from within a script, using `subprocess.POPEN`

Hello: A series of applications I'm writing require that the user be able to read from a filesystem with KLOG authentication. Some functions require the user to have KLOG tokens (i.e., be authenticated) and others don't. I wrote a small Python decorator so that I can refactor the "you must be KLOGed" functionality within my modules: # ...

PyGtk - TreeView and selected row

Hi, I have a TreeView and when I click in it, i receive the error: Traceback (most recent call last): File "pyparty.py", line 76, in get_selected_user self.selected_user = tree_model.get_value(tree_iter, 0) TypeError: iter must be a GtkTreeIter It just happen for the first click. After that it works fine. I don't know what's wro...

how do i set a timeout value for python's mechanize?

How do i set a timeout value for python's mechanize? ...

Using Python to manipulate the GUI's of other programs?

I have a program here that has an entry box and a button. I want python to enter a string into the entry box, then press the button. What is the best way of going about this? This is for windows 7, BTW. ...

image processing

Hi, This is an assignment, i have put good effort since i am new to python programming: I am running the following function which takes in image and phrase (spaces will be removed so just text) as arguments, i have already been given all the import and preprocessing code, i just need to implement this function. I can only use getpixel...

how do i get python's mechanize to stop following meta refresh redirects?

I have a script which gets a webpage with a meta refresh. I need to parse the retrieved page but mechanize seems to follow the redirect. How do I get it to stop following it? ...

Help with my keylogger

I'm working on a simple key logger. I'm having a problem though, when I try to run it as a .pyw the program shuts down before it can record anything. I believe it needs to loop, how would I go about this? import pythoncom, pyHook, sys, logging, time LOG_FILENAME = 'C:\KeyLog\log.out' def OnKeyboardEvent(event): keytime = time....

Python parser script layout

Hi everyone! I'm writing a simple Python parser, where I loop over each line in a file, and prosess it further if the right conditions are met. My short start: def identify(hh_line): if(re.match(regex.new_round, hh_line)): m = re.match(regex.new_round, hh_line) # insert into psql ... ...

python setup.py bdist_egg Not Setting Up Requirements for Package

I have a Pylons app that I am ready to deploy for the first time to production. It has a simple set of requirements listed in setup.py: install_requires=[ "Pylons>=1.0", "Jinja2", "couchdb", "python-openid", ], When I run "python setup.py bdist_egg" it seems to create the egg file properly. When I copy the egg file to ...

How do I loop this program?

Once the program prints, it shuts down. How do I make it returns to the top of the code so that it loops, indefinitely asking for the users name? code: from time import sleep name = raw_input ("Please enter your name: ") print "Hello", name, "- good to see you!" sleep(2.00) pseudo-code: from time import sleep A name = raw_input (...