python

cPickle ImportError: No module named multiarray

Hello, I'm using cPickle to save my Database into file. The code looks like that: def Save_DataBase(): import cPickle from scipy import * from numpy import * a=Results.VersionName #filename='D:/results/'+a[a.find('/')+1:-a.find('/')-2]+Results.AssType[:3]+str(random.randint(0,100))+Results.Distribution+".lft" filename='D:/results/pppp...

Django facebook integration error

I'm trying to integrate facebook into my application so that users can use their FB login to login to my site. I've got everything up and running and there are no issues when I run my site using the command line python manage.py runserver But this same code refuses to run when I try and run it through Apache. I get the following erro...

Using Pycairo to generate images dynamically and serve in Django

I want to generate a dynamically created png image with Pycairo and serve it usign Django. I read this: http://stackoverflow.com/questions/1074200/serve-a-dynamically-generated-image-with-django. Is there a way to transport data from Pycairo surface directly into HTTP response? I'm doing this for now: data = surface.to_rgba() im = Imag...

Is there a way to set a fixed width for the characters in HTML?

Is there a way to set a fix size for the characters in HTML? That means, say … First row, 8th character is “Z” Second row’s 8th character is “A” I want to print out , when printed the “Z” has to be exactly on top of “A” *Note: I'm using the insertHtml method in QTextEdit() ...

How to send html email with django with dynamic content in it?

Hi all, Can anyone please help me sending html email with dynamic contents. One way is to copy the entire html code into a variable and populate the dynamic code within it in Django views, but that does not seem to be a good idea, as its a very large html file. I would appreciate any suggestions. Thanks. ...

WindowsError [error 5] Access is denied

Hi, I'm using the killableprocess package (built on top of subprocess) for running processes Whenever I run the "killableprocess.Popen(command)" piece of code in my script I get the following error: File "killableprocess.py", line 157, in _execute_child winprocess.AssignProcessToJobObject(self._job, hp) File "winprocess.py", lin...

How to make a simple clipboard monitor in python

Hi! I was wondering how to make a simple Clipboard Monitor in python, for GUI I'm using PyGTK. I found gtk.clipboard class and all that but I couldn't find any solution to get the "signals" to trigger the event when the clipboard content has changed :( Any ideas? Thanks you! :) ...

Python logging is outputting with the time 4 hours ahead of system

My system is set to EDT in Linux, and I can confirm this in Python with datetime.now(). However the logger is outputting 4 hours ahead. What could be the cause of this? EDIT: Logging config looks like this: logging.basicConfig(level=logging.DEBUG) lf = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") mylogger ...

Ubuntu One Folder Sync Filter

Hi, I am trying to modify the Ubuntu One File syncing python scripts to not including things like .iso's. I have got as far as finding this file: /usr/share/pyshared/ubuntuone/u1sync/constants.py Inside is this piece of code: import re # the name of the directory u1sync uses to keep metadata about a mirror METADATA_DIR_NAME = u".ubun...

encrypting passwords in a python conf file on a windows platform

Hello all. I have a script running on a remote machine. db info is stored in a configuration file. I want to be able to encrypt the password in the conf text so that no one can just read the file and gain access to the database. This is my current set up: My conf file sensitive info is encoded with base64 module. The main script then de...

Create event for another owner using Facebook Graph API

Hi, I'm at the moment working on a web page where the users who visit it should have the possibility to create an event in my web page's name. There is a Page on Facebook for the web page which should be the owner of the user created event. Is this possible? All users are authenticated using Facebook Connect, but since the event won't ...

Python class decorator and maximum recursion depth exceeded

I try define class decorator. I have problem with __init__ method in decorated class. If __init__ method invokes super the RuntimeError maximum recursion depth exceeded is raised. Code example: def decorate(cls): class NewClass(cls): pass return NewClass @decorate class Foo(object): def __init__(self, *args, **kwargs): ...

Django message doesn't expire

My code in the view: from django.contrib import messages messages.add_message(request, messages.INFO, 'Hello world.') I don't want to show this code to the user the second time if he/she refreshes again. How do I go about doing that? Messages don't seem to have any sort of expiry setting. There is documentation here: http://doc...

send XML generated from python to Hudson

we can send the result of a program to Hudson in XML format as shown here http://wiki.hudson-ci.org/display/HUDSON/Monitoring+external+jobs this works fine! now I tried writing a python script to generate an xml of similar format. it runs fine in python IDLE and gives the desired xml. the problem I am facing is, I don't understand how c...

Correct way to protect a private API Key when versioning a python application on a public git repo

I would like to open-source a python project on Github but it contains an API key that should not be distributed. I guess there's something better than removing the key each time a "push" is committed to the repo. Imagine a simplified foomodule.py : import urllib2 API_KEY = 'XXXXXXXXX' urllib2.urlopen("http://example.com/foo?id=123%s" ...

easy_install ReviewBoard [Errno 104] Connection reset by peer

I have a Kubuntu 10.04 VM image and am trying to install ReviewBoard by following The Linux Installation Wiki. When I get to the step to easy_install ReviewBoard, I encounter a problem I cannot find a solution to. Below is the console output: >> sudo easy_install ReviewBoard Searching for ReviewBoard Best match: ReviewBoard 1.0.8 Proces...

Random Loss of precision in Python ReadLine()

Hi all, We have a process which takes a very large csv (1.6GB) and breaks it down into pieces (in this case 3). This runs nightly and normally doesn't give us any problems. When it ran last night, however, the first of the output files had lost precision on the numeric fields in the data. The active ingredient in the script are the...

problem with python script

I want to run a csh file from a python script, example, #!/usr/bin/python import os os.system("source path/to/file.csh") and I want this file to run in the same shell as I am running the python script, because the file.csh script is settings some environment variables that I need. Does anyone know how to do this in Python? ...

Basic Python While loop compound conditional evaluation

In Python IDLE Shell it seems I cannot use a compound conditional expression and a while loop. I tried it within brackets too. Take these two examples: k=0 m=0 while k<10 & m<10: print k k +=1 m+=1 This doesn't evaluate the second condition. But if I write while k<10: print k k+=1 This does work. Is there a wa...

Python SUDS - problem with sending a message encoded not in UTF-8

I need to send a SOAP message (with Python SUDS) with strings encoded in 'iso-8859-2'. Does anybody know how to do it? SUDS raises the following exception when I invoke a method on a client with parameters encoded in 'iso-8859-2': File "/home/bartek/myenv/lib/python2.5/site-packages/suds/sax/text.py", line 43, in __new__ result = su...