python

Deleting the most recently received email via Python script?

I use Gmail and an application that notifies me if I've received a new email, containing its title in a tooltip. (GmailNotifier with Miranda-IM) Most of the emails I receive are ones I don't want to read, and it's annoying having to login to Gmail on a slow connection just to delete said email. I believe plugin is closed source. I've be...

How can I write a Nokia application with pyqt?

I have seen questions on my Facebook group about 'Can I write Nokia apps with pyqt', but no one has answered. I am curious, can it be done? ...

How to switch to a python subprocess created by IPython (on OS X)?

When I use IPython along with the -wthread option, it spawns a python subprocess, which appears as a Mac OS X application. My problem is that when I send commands to that application (for example plotting with matplotlib), the window is updated behind all my other windows. I would like to be able to call a python command to switch this ...

Python: Creating Excel worksheets with charts

Hi, Is there any module for creating Excel charts with embedded charts in Python? The modules mentioned in this question don't seem to have that capability. I prefer a generic module that would work under Ubuntu, not a Windows-dependent one. EDIT: I will also appreciate ways to embed images within the created charts, as I can create t...

Accessing local django webserver from outside world

I followed the instructions here to run Django using the built-in webserver and was able to successfully run it using "python manage.py runserver". If I access 127.0.0.1:port locally from the webserver, I get the Django page indicating it worked. I realize the Django webserver is not a production server, but it's important for me for t...

GAE datastore viewer - editing lists

Is it possible to somehow enable editing lists in GAE datastore viewer? I'm using Python version of SDK. Basically I want to avoid, as much as possible, writing own CRUD as it wouldn't be necessary if only I could edit lists in datastore viewer.. ...

Weird problem with input encoding in IPython

Hello! I'm running python 2.6 with latest IPython on Windows XP SP3, and I have two questions. First one of my problems is, when under IPython, I cannot input Unicode strings directly, and, as a result, cannot open files with non-latin names. Let me demonstrate. Under usual python this works: >>> sys.getdefaultencoding() 'ascii' >>> s...

How can I resize the root window in Tkinter?

from Tkinter import * import socket, sys from PIL import Image, ImageTk root = Tk() root.title("Whois Tool") root.resizable(0, 0) text = Text() text1 = Text() image = Image.open("hacker2.png") photo = ImageTk.PhotoImage(image) label = Label(root, image=photo) label.pack() text1.config(width=15, height=1) text1.pack() def button1()...

Python: How to make multiple HTTP POST queries in one moment?

How to make multiple HTTP POST queries in one moment using Python? Using an external library with an example can be a good solution. ...

How can I put 2 buttons next to each other?

b = Button(root, text="Enter", width=10, height=2, command=button1) b.config() b.pack(side=LEFT) c = Button(root, text="Clear", width=10, height=2, command=clear) c.pack(side=LEFT) scrollbar = Scrollbar(root) scrollbar.pack(side=RIGHT, fill=Y) text.config(width=35, height=15) text.pack(side=RIGHT, fill=Y) scrollbar.config(command=text...

PyRo and python

I use PyRo in my python programm. And I have a problem. class B: In callFromProxy print 0, but in callfun print right value = 10. Why? How to fix? class A(Pyro.core.ObjBase): # set link to item class B def set(self, real_B): self.item_B = real_B # call function callfun in item_B def callfun(self): self.item_B.callfun(10) class...

AMQP C++ implementation

We are writing C++ code which needs messaging. Is there a free/open-source and stable AMQP server available that has equally stable C++ client library with it. We also need to provide Python interface of our code to users (idea is to do maximum stuff in C++ and expose the API in Python). What can be best way to achieve this. ...

Indicating that GET response is complete w/ Python AppEngine

When I get a GET request from a user, I send them the response and then spend maybe a second logging stuff about that request. Is there a way to close the connection when I have the response ready, but continue doing that logging part, so that the user wouldn't have to wait for it to complete? ...

Python repr function problem

Hi, I'm dealing with some text parsing in Python and for that purpose, it's good for me to apply repr() function on each string I'm gonna parse, but after the parsing, I need to convert some parsed substring back to the previous representation, because I want to print them and I'm not able to do this. I thought that str() function shoul...

How to parse just the text from a Word Doc using Python?

When you try opening a MS Word document or for that matter most Windows file formats, you will see gibberish as given below broken intermittently by the actual text. I need to extract the text that goes in and want to ignore the gibberish -- which is something like given below. How do I extract only the text that matters, and ignore rest...

Python equivalent of C code from Bit Twiddling Hacks?

I have a bit counting method that I am trying to make as fast as possible. I want to try the algorithm below from Bit Twiddling Hacks, but I don't know C. What is 'type T' and what is the python equivalent of (T)~(T)0/3? A generalization of the best bit counting method to integers of bit-widths upto 128 (parameterized by type T...

URL redirection problem

i have the below url http://bit.ly/cDdh1c When you place the above url in a browser and hit enter it will redirect to the below url http://www.kennystopproducts.info/Top/?hop=arnishad But where as when i try to find the base url (after eliminating all the redirect urls) for the same above url http://bit.ly/cDdh1c via a python prog...

List comprehension and functions

I'm a little confusing when try something like this b = [lambda x:x**i for i in range(11)] When I then try b[1](2) I have 1024 as a result that is wrong. But when I write so b = [(lambda i: lambda x:x**i)(i) for i in range(11)] all is OK >>> b[1](2) 2 >>> b[5](2) 32 It works fine but what's wrong in first code? ...

boost::python Export Custom Exception

I am currently writing a C++ extension for Python using Boost::Python. A function in this extension may generate an exception containing information about the error (beyond just a human-readable string describing what happened). I was hoping I could export this exception to Python so I could catch it and do something with the extra inf...

How to install Python ssl module on Windows?

The Google App Engine Launcher tells me: WARNING appengine_rpc.py:399 ssl module not found. Without the ssl module, the identity of the remote host cannot be verified, and connections may NOT be secure. To fix this, please install the ssl module from http://pypi.python.org/pypi/ssl . I downloaded the package and it contained ...