python

Python+Django social network open source projects

Hey, I'm looking for some open source, free to change and use project written on Pyton+Django with following features: Blog (for site, not for users) Users Registration User Profiles Adding friends, watching what friends added Award system for active users (carma, rating) Content rating Comments Probably different users levels (for a...

Encrypted Django Model Fields

A client wants to ensure that I cannot read sensitive data from their site, which will still be administered by me. In practice, this means that I'll have database access, but it can't be possible for me to read the contents of certain Model Fields. Is there any way to make the data inaccessible to me, but still decrypted by the server t...

Issues with scoped_session in sqlalchemy - how does it work?

I'm not really sure how scoped_session works, other than it seems to be a wrapper that hides several real sessions, keeping them separate for different requests. Does it do this with thread locals? Anyway the trouble is as follows: S = elixir.session # = scoped_session(...) f = Foo(bar=1) S.add(f) # ERROR, f is already attached to sess...

Custom/Owner draw control in PyQt?

I am learning PyQt and wonder if one can create custom/owner draw control like one show in the figure below: The search box has magnifier icon on its right border. Is this kind of thing possible with PyQt? Thanks! ...

Django: How can you stop long queries from killing your database?

I'm using Django 1.1 with Mysql 5.* and MyISAM tables. Some of my queries can take a TON of time for outliers in my data set. These lock the tables and shut the site down. Other times it seems some users cancel the request before it is done and some queries will be stuck in the "Preparing" phase locking all other queries out. I'm going...

I'm a .NET Programmer. What are specific uses of Python and/or Ruby for that will make me more productive?

I recall when I first read Pragmatic Programmer that they suggested using scripting languages to make you a more productive programmer. I am in a quandary putting this into practice. I want to know specific ways that using Python or Ruby can make me a more productive .NET developer. One specific way per answer, and even better if you ...

Should I optimise my python code like C++? Does it matter?

I had an argument with a colleague about writing python efficiently. He claimed that though you are programming python you still have to optimise the little bits of your software as much as possible, as if you are writing an efficient algorithm in C++. Things like: In an if statement with an or always put the condition most likely to ...

Handling KeyboardInterrupt in a KDE Python application?

Hi, I'm working on a PyKDE4/PyQt4 application, Autokey, and I noticed that when I send the program a CTRL+C, the keyboard interrupt is not processed until I interact with the application, by ie. clicking on a menu item or changing a checkbox. lfaraone@stone:~$ /usr/bin/autokey ^C^C^C Traceback (most recent call last): File "/usr/lib...

Creating SVGs using Python

I'm building a set of SVG files that include an unfortunate number of hardcoded values (they must print with some elements sized in mm, while others must be scaled as a percent, and most of the values are defined relative to each other). Rather than managing those numbers by hand (heaven forbid I want to change something), I thought I mi...

any body familiar with how I can implement a multiprocessing priority queue in python?

any body familiar with how I can implement a multiprocessing priority queue in python? ...

Using HTML Parser with HTTPResponse in Python 3.1

The response data from HTTPResponse object is of type bytes. conn = http.client.HTTPConnection(www.yahoo.com) conn.request("GET","/") response = conn.getresponse(); data = response.read() type(data) The data is of type bytes. I would like to use the response along with the built-in HTML parser of Python 3.1. However I find that HTML...

Split Twitter RSS string using Python

Hi, I am trying to parse Twitter RSS feeds and put the information in a sqlite database, using Python. Here's an example: u'MiamiPete: today\'s "Last Call" is now up http://bit.ly/MGDzu #stocks #stockmarket #finance #money' What I want to do is create one column for the main content ("Miami Pete....now up)", one column for the URL ("ht...

Storing huge hash table in a file in Python

Hey. I have a function I want to memoize, however, it has too many possible values. Is there any convenient way to store the values in a text file and make it read from them? For example, something like storing a pre-computed list of primes up to 10^9 in a text file? I know it's slow to read from a text file but there's no other option i...

python object to native c++ pointer

Im toying around with the idea to use python as an embedded scripting language for a project im working on and have got most things working. However i cant seem to be able to convert a python extended object back into a native c++ pointer. So this is my class: class CGEGameModeBase { public: virtual void FunctionCall()=0; virtu...

How to tell if a full-screen application is running?

Is it possible in python to tell if a full screen application on linux is running? I have a feeling it might be possible using Xlib but I haven't found a way. EDIT: By full screen I mean the WHOLE screen nothing else but the application, such as a full-screen game. ...

Python code to download a webpage using JavaScript

Hi, Im trying to download share data from a stock exchange using python. The problem is that there is no direct download link, but rather a javascript to export the data. The data page url: http://tase.co.il/TASE/Templates/Company/CompanyHistory.aspx?NRMODE=Published&NRORIGINALURL=%2fTASEEng%2fGeneral%2fCompany%2fcompanyHistoryD...

Latin letters with acute : DjangoUnicodeDecodeError

Hi, I have a problem reading a txt file to insert in the mysql db table, te sniped of this code: file contains the in first line: "aclaración" archivo = open('file.txt',"r") for line in archivo.readlines(): ....body = body + line model = MyModel(body=body) model.save() i get a DjangoUnicodeDecodeError: 'utf8' codec can't...

Python classes -- mutability

Im having a problem with python.. I have a binary tree node type: class NODE: element = 0 leftchild = None rightchild = None And I had to implement a function deletemin: def DELETEMIN( A ): if A.leftchild == None: retval = A.element A = A.rightchild retur...

How does this Python code work?

I don't know if it is feasable to paste all of the code here but I am looking at the code in this git repo. If you look at the example they do: ec2 = EC2('access key id', 'secret key') ...but there is no EC2 class. However, it looks like in libcloud\providers.py there is a dict that maps the EC2 to the EC2NodeDriver found in libclou...

Why is the C++ syntax so complicated?

I'm a novice at programming although I've been teaching myself Python for about a year and I studied C# some time ago. This month I started C++ programming courses at my university and I just have to ask; "why is the C++ code so complicated?" Writing "Hello world." in Python is as simple as "print 'Hello world.'" but in C++ it's: # in...