python

How show/draw a image in the desktop pyqt?

Thats the question, how show images in the desktop, no images in a windows, something like screenlets, but I don wan't to use plasma, i'm using linux. Yes, I want to do a simple widget engine, with pyqt and svg. ...

How would you group up articles by context? - Natural Language

Hi folks, I have lists of articles made of: title, subtitle and body. Now I need to parse all these articles and group them up under different context categories or sub categories based on their possible keywords. e.g. if the article is likely to be related to sports cars then the article would be associated with the car or/and veh...

Asynchronous api for obtaining GPS position in python for S60

I'm using positioning.position(). but this function is blocking. I want to be able to run another function while the GPS is being measured. thanks ...

Python decorators and class inheritance

I'm trying to use decorators in order to manage the way users may or may not access resources within a web application (running on Google App Engine). Please note that I'm not allowing users to log in with their Google accounts, so setting specific access rights to specific routes within app.yaml is not an option. I used the following r...

Is there a visual profiler for Python?

I use cProfile now but I find it tedious to write pstats code just to query the statistics data. I'm looking for a visual tool that shows me what my Python code is doing in terms of CPU time and memory allocation. Some examples from the Java world are visualvm and JProfiler. Does something like this exist? Is there an IDE that does t...

Python and sqlite trouble

Hello, I can't show the data from database sqlite in python. connection = sqlite3.connect('db') connection.cursor().execute('CREATE TABLE IF NOT EXISTS users ( \ id TEXT, \ name TEXT, \ avatar T...

Deploying python app to Mac and Windows users

I've written an app in python that depends on wxPython and some other python libraries. I know about pyexe for making python scripts executable on Windows, but what would be the easiest way to share this with my Mac using friends who wouldn't know how to install the required dependencies? One option would be to bundle my dependencies in ...

Proper way to edit existing entity in tipfy

I'm using a PersonEditHandler class in tipfy to edit a Person entity. I have the get() and post() methods formed, but when I reference self.person (to check if the get method found the existing person by key), I get an 'object has no attribute' error. This is because I never initialize it in the init method since I'm inheriting from...

Python and MySQL compile version

How do I check if my python and mysql are 32 bit installations or 64 bit? ...

call external python script in same window

Hello, Im trying to call an external python script, and so far i was able to do so successfully using: os.system("START fileNameHere") However right now im running in the console, and i want the contents of the other python file to be shown in the same console. ATM it shows it in a separate console. Thanks in Advance. ...

Writing blob from SQLite to file using Python

Hello, A clueless Python newbie needs help. I muddled through creating a simple script that inserts a binary file into a blog field in a SQLite database: import sqlite3 conn = sqlite3.connect('database.db') cursor = conn.cursor() input_note = raw_input(_(u'Note: ')) input_type = 'A' input_file = raw_input(_(u'Enter path to file...

Which is the most preferred language to start with dynamic languages

After working for on JAVA for a long time now i feel like also learn some other language just for a change. This time i want to spend some time learning and reading one of the dynamic languages. Which is the most appropriate one that covers most of the features offered by dynamic languages and the syntax which probably is fun and also ...

Why doesn't mydict.items().sort() work?

When I try and sort my dictionary, I get an error: ''nonetype' object is not iterable. I am doing: for k,v in mydict.items().sort(): ...

using numpy in cython: defining ndarray datatype/ndims

Hello all, I'm trying to write some cython code to do computations with numpy arrays. Cython seems to not like the [] used in all the examples I've seen to define the datatype and number of dimensions. For example, I have a file test.pyx: cimport numpy as np import numpy as np ctypedef np.ndarray[np.float64_t, ndim=2] mymatrix c...

Using Numpy Vectorize on Functions that Return Vectors

numpy.vectorize takes a function f:a->b and turns it into g:a[]->b[]. This works fine when a and b are scalars, but I can't think of a reason why it wouldn't work with b as an ndarray or list, i.e. f:a->b[] and g:a[]->b[][] For example: import numpy as np def f(x): return np.array([1,1,1,1,1], dtype=np.float32) * x g = np.vectorize(f,...

ModelForm and error_css_class

Hi guys, my problem is simple. Where the right place for a custom error_css_class value is when using ModelForm? I tried this: class ToolForm(ModelForm): error_css_class = 'wrong_list' class Meta: model = Tool widgets = { 'name' : TextInput(attrs={'class': 'small_input corners'}), 'description' : T...

Can Python be good alternative for web app that would otherwise be done in JEE / J2EE?

Hi, Can Python be a good alternative to a web app that would otherwise be developed with JEE / J2EE? If so, which Python web app framework(s) may be a good choice? Please see details about the app below. I've asked a few people individually about this, who have worked for a good amount of time on either or both of JEE and Python web app...

Django Fixtures Error: Unknown Applicaiton

I have a project w/ multiple apps. I am attempting to use the dumpdata command to create a fixture for each app. Calling dumpdata on a given app seems to work well. This prints the data to the console: python manage.py dumpdata myapp However, when I attempt to create a json file containing the dumped data: python manage.py dumpdat...

strings in hebrew in python for s60

I'm using python for S60. I want to use string in hebrew, to represent them on the GUI and to send them in SMS message. It seems that the PythonScriptShell don't accept such expressions, for example: u"אבגדה" what can I do? thanks development of situation: I added the line: # -*- coding: utf-8 -*- as the first line in the source ...

min max algorithm in python

In the minmax algorithm,How to determine when your function reaches the end of the tree and break the recursive calls. I have made a max function in which I am calling the min function. In the min function , what shud I do?? For max function, I am just returning the bestscore. def maxAgent(gameState, depth): if (gameState.isWin()...