python

How to call a specific, unknown Python object attribute?

I'm working to create a simple Python script that will ultimately tell you how many blog entries were posted in a given month, and the pyblog app is proving very helpful. However, when I create the blog object, I don't know how to access it's various attributes. I can print them all out by printing one item from the dictionary, as shown...

What does suds mean by "<faultcode/> not mapped to message part" ?

I'm using suds for the first time and trying to communicate with a server hosted by an external company. When I call a method on the server I get this XML back. < ?xml version="1.0" encoding="UTF-8"?> < soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xml...

Python and MySQLdb

I have the following query that I'm executing using a Python script (by using the MySQLdb module). conn=MySQLdb.connect (host = "localhost", user = "root",passwd = "<password>",db = "test") cursor = conn.cursor () preamble='set @radius=%s; set @o_lat=%s; set @o_lon=%s; '%(radius,latitude,longitude) query='SELECT *, (6371*1000 * acos(co...

any gae framework for GAE User registry without Google Accounts

i want to find a webapp framework for validation user , store user, and has ajax Effect of jquery , so ,did you know this simply framework ? thanks like this page : http: //digu.com/reg ...

How can I create a simple message box in Python?

I'm looking for the same effect as alert() in JavaScript. I wrote a simple web-based interpreter this afternoon using Twisted.web. You basically submit a block of Python code through a form, and the client comes and grabs it and executes it. I want to be able to make a simple popup message, without having to re-write a whole bunch of bo...

Problems installing a package from PyPI: root files not installed

After installing the BitTorrent-bencode package, either via easy_install BitTorrent-bencode or pip install BitTorrent-bencode, or by downloading the tarball and installing that via easy_install $tarball, I discover that /usr/local/lib/python2.6/dist-packages/BitTorrent_bencode-5.0.8-py2.6.egg/ contains EGG-INFO/ and test/ directories. A...

Windows environment variables change when opening command line?

Sometimes when I change my environment variables in Windows, and then use software the depends on those variables, they are not properly updated. And good example is to change a variable, then open up Windows Command Line and echo the variable and see that it hasn't been changed, even though you properly changed it in the Environment Va...

How refresh a DrawingArea in PyGTK ?

I have an interface created with Glade. It contains a DrawingArea and buttons. I tried to create a Thread to refresh every X time my Canva. After a few seconds, I get error messages like: "X Window Server 0.0", "Fatal Error IO 11" Here is my code : import pygtk pygtk.require("2.0") import gtk import Canvas import threading as T impor...

GAE: ValueError: insecure string pickle

I'm having trouble unpickling objects from Google App Engine. I am running Windows 7. Here is the procedure: Create a CSV with one of the fields being pickle.dumps([[('CS', 2110), ('CS', 3300), ('CS', 3140)]]), or some similar argument. The CSV looks something like this: INFO,2210,"CS 2110, 3300, 3140","(lp0 (lp1 (S'CS' p2 I2110 tp3...

multi threading python/ruby vs java?

i wonder if the multi threading in python/ruby is equivalent to the one in java? by that i mean, is it as efficient? cause if you want to create a chat application that use comet technology i know that you have to use multi threading. does this mean that i can use python or ruby for that or is it better with java? thanks ...

Python: NameError: 'self' is not defined

I must be doing something stupid. I'm running this in Google App Engine: class MainHandler(webapp.RequestHandler): def render(self, template_name, template_data): path = os.path.join(os.path.dirname(__file__), 'static/templates/%s.html' % template_name) self.response.out.write(template.render(path, template_data)) #...

best CAPTCHA framework for gae.

i need a CAPTCHA framework on google-app-engine what a CAPTCHA framework you are using . thanks like this :http://recaptcha.net/learnmore.html ...

sorting in python

I have a hashmap like so: results[tweet_id] = {"score" : float(dot(query,doc) / (norm(query) * norm(doc))), "tweet" : tweet} What I'd like to do is to sort results by the innser "score" key. I don't know how possible this is, I saw many sorting tutorials but they were for simple (not nested) data structures. ...

Python - Converting CSV to Objects - Code Design

Hi, I have a small script we're using to read in a CSV file containing employees, and perform some basic manipulations on that data. We read in the data (import_gd_dump), and create an Employees object, containing a list of Employee objects (maybe I should think of a better naming convention...lol). We then call clean_all_phone_numbers...

How to write a copyright message using matplotlib

I am creating some graphs using matplotlib, and I want to be able to write a copyright message and my website address at the bottom of the image. Something like: © ACME Corp www.example.com Does anyone know how I may do this? ...

python win32 simulate click

Let's say I've got a window for which I want to simulate a mouse click at a specific x, y coordinate. I already have the hwnd but I'm not sure how to construct the lParam. I've used SendMessage in the past to click on buttons, etc., but I knew their hwnds. Any help would be greatly appreciated. I also can't help but wonder if I'm going a...

Is it possible to put a toolbar button on the right side of it using wxpython?

Hello, I'm making a toolbar using wxpython and I want to put the Quit button on the right side of it, I don't want to put them sequencially. Is it possible to define this position? Thanks in advance! ...

Python: How should I make instance variables available?

Suppose I have: class myclass: def __init__(self): self.foo = "bar" where the value of foo needs to be available to users of myclass. Is it OK to just read the value of foo directly from an instance of myclass? Should I add a get_foo method to myclass or perhaps add a foo property? What's the best practice here? ...

Django: Meaning of leading underscore in list of tuples used to define choice fields?

I've seen a few examples defining choice fields like so: COUNTRIES = ( ('fr', _('France')), ('de', _('Germany')), ... ) (source: http://code.djangoproject.com/ticket/5446 Also see: http://djangosnippets.org/snippets/494/) What is the meaning of the leading underscores? And why is the second value in the tuple even parent...

More efficient web framework than Web.py? Extremely Pythonic please!

I love webpy, it's really quite Pythonic but I don't like having to add the url mappings and create a class, typically with just 1 function inside it. I'm interested in minimising code typing and prototyping fast. Does anyone have any up and coming suggestions such as Bobo, Nagare, Bottle, Flask, Denied, cherrypy for a lover of webpy's ...