python

Python win32com - application installed with both 32bit and 64bit versions

Hi, I am using pythons win32com module to automate Adobe Photoshop. This works fine on some machines (have had issues with it not working on users with limited windows account permissions, but thats another issue). But on machines with both the 32bit and 64bit versions of Photoshop installed, I am getting errors when trying to access c...

twisted on centos missing mail.smtp?

I'm trying to get buildbot running on centos5, and getting the following error: File "/usr/lib/python2.4/site-packages/buildbot/status/mail.py", line 14, in ? from twisted.mail.smtp import sendmail, ESMTPSenderFactory ImportError: No module named mail.smtp I have the following twisted packages installed (and don't see anything e...

Differences and uses between WSGI, CGI, FastCGI, and mod_python in regards to Python?

I'm just wondering what the differences and advantages are for the different CGI's out there. Which one would be best for python scripts, and how would I tell the script what to use? Thanks! ...

How do I use rstrip to remove trailing characters?

I am trying to loop through a bunch of documents I have to put each word in a list for that document. I am doing it like this. stoplist is just a list of words that I want to ignore by default. texts = [[word for word in document.lower().split() if word not in stoplist] for document in documents] I am returned with a list of...

Python Method Placement

Can someone give me a solution to this dosomething() def dosomething(): print 'do something' I don't want my method defines up at the top of the file, is there a way around this? ...

what is the concept of store in OpenID

Hi so this is what I understand how Openid works:- the user enters his openid url on the site say"hii.com" The app does a redirect to the openid provider and either does the login or denies it and sends the response back to the site i.e"hii.com" If authentication was succesful then the response object provided by the openid provider ca...

Is it possible to pre-create a virtualenv for use in hudson builds?

I'm following the outline of the hudson/python/virtualenv CI solution described at heisel.org but one step of this is really chafing, and that's the part where the virtualenv, created just for the CI run, is configured: pip install -q -E ./ve -r requirements.pip pip install -q -E ./ve -r requirements-test.pip This takes an inordinate ...

Import problems using GAE and python 2.5

So here are my classes and when I run I dont get any error at all just exits: User class in user.py from models.WO_list import WOList from models.WO_list_user import WOListUser WOList class in WO_list.py from models.user import User from models.WO_list_WO import WOListWO WOListWO class in WO_list_WO.py from models.WO_list import ...

Any value in catching an exception and immediately raising it again?

Possible Duplicate: Does a exception with just a raise have any use? Is there any value to re-raising an exception with no other code in between? try: #code except Exception: raise I was recently looking through some code and saw a few blocks like these with nothing extra in the except block but another raise. I assume ...

Destop application in Python with more than one frame!

I have developed many desktop applications in Delphi / Pascal - Here I have used modal forms. //Mainform Form1:= TForm1.Create(Self); If Form1.Showmodal =mrOK then …. In Form1 you cal call vars in Mainform like mainform.X := 1 (I know – I normaly use try,except, finally) I will now switch to Python and my problem is the follo...

Convert higher order function from Python to Haskell

I have the following code: import operator def stagger(l, w): if len(l)>=w: return [tuple(l[0:w])]+stagger(l[1:], w) return [] def pleat(f, l, w=2): return map(lambda p: f(*p), stagger(l, w)) if __name__=="__main__": print pleat(operator.add, range(10)) print pleat(lambda x, y, z: x*y/z, range(3, 13), 3) ...

Social network visualization tools for PHP/JavaScript

I'm looking for a tool that will allow me to display visualizations of social networks dynamically online. There are a lot of great visualization examples out there already: http://www.readwriteweb.com/archives/the_best_tools_for_visualization.php http://socialmediatrader.com/10-amazing-visualizations-of-social-networks/ I know lots ...

Is it really possible to POST files with python ?

So I'm struggling with this for a second day in a row and still nothing. Found few solutions on the internet but still I'm getting "Internal Server Error" when trying to send files with POST. The idea is as follows : I'm sending a file opened in python's shell to a django function on my server that will read and store the file there. I'v...

How do I encode and decode PER-encoded data in Python?

I need to be able to decode and encode PER-encoded octet strings using Python. I found PyASN1, but it doesn't include a PER codec. Is there another solution out there? How difficult would it be to write a PER codec? ...

MySQL server has gone away error with Pylons, SQLAlchemy, Apache

sorry if this is addressed, but i'm running apache2 SQLAlchemy 0.5.8 Pylons 1.0 Python 2.5.2 and on a simple page (just retrieve data from DB), I get: Error - : (OperationalError) (2006, 'MySQL server has gone away') every few other requests, not after a long time as other posts I've searched for. I still added sqlalchemy....

Appengine create and export yaml file

Hi, I´m having trouble in creating a file and export to .yaml. I´m using Google App Engine with Python 2.5. Don´t understand the Yaml doc´s, it makes me confused. What i want is to create a file and save it. It´s necessary to get entities from Models. class SaveYAML(webapp.RequestHandler): def post(self): user = db.Query(m...

fitting exponential decay with no initial guessing

Does anyone know a scipy/numpy module which will allow to fit exponential decay to data? Google search returned a few blog posts, for example - http://exnumerus.blogspot.com/2010/04/how-to-fit-exponential-decay-example-in.html , but that solution requires y-offset to be pre-specified, which is not always possible EDIT: curve_fit wor...

[python] get numbers from user & print maximum and minimum (w/o using built-in function)

I'm reviewing a python exercise which does the following : reads list of numbers til "done" gets entered. When "done" is inputted, print largest and smallest of the numbers. And it should be without directly using the built-in functions, max() and min(). Here is my source. Traceback says, "'float' object is not iterable" I think my...

Anyone have a tool to detect python logger statements with an invalid number of arguments?

e.g. if you have code that does something like this somewhere in your codebase: >>> import logging >>> logging.basicConfig() >>> logger = logging.getLogger(__name__) >>> logger.critical("foo: %s", 1, 2) Traceback (most recent call last): File "/pluto/local/lib/python2.6/logging/__init__.py", line 768, in emit msg = self.format(rec...

subprocess() arguments in Python

I have an argument in Python that is screwing up my subprocess() command. The argument is: --server-args="-screen 0, 1280x800x24" args = [ 'xvfb-run', '--server-args="-screen 0, 1280x800x24"', '/usr/bin/python', '/root/AdamN-python-webkit2png-3ae4322/webkit2png.py', '-o', filename, url, ] I think it's escaping the doubl...