python

Problems with django deployment

Im trying to deploy my django and I always get one of these erros: (they alternate as I refresh the page) The model Page has already been registered ( its from feincms, but i dont get this on my computer ) unable to open database file (the database is sqlite3 and was successfully created with syncdb on the server ) Any ideas on what ...

What's the best way to implement a decision tree in Python?

How to do it? What design patterns? Ideally would be sample code in the answer. ...

Python Command Line "characters" returns 'characters'

Thanks in advance for your help. When entering "example" at the command line, Python returns 'example'. I can not find anything on the web to explain this. All reference materials speaks to strings in the context of the print command, and I get all of the material about using double quotes, singles quotes, triple quotes, escape command...

how can I call view method in different files

If I have one view which called myview1.py and I want to call a view which is located in myview2.py, how can I do that? should I import myview2.py somehow? ...

Summing Non-Integers in Python sum([[1],[2]]) = [1,2]

Is it possible to take the sum of non-integers in python? The command sum([[1],[2]]) for example, gives the error Traceback (most recent call last): File "<pyshell#28>", line 1, in <module> sum([[1,2,3],[2,3,4]]) TypeError: unsupported operand type(s) for +: 'int' and 'list' I suspect sum tries to add 0 to the list [1], resu...

Python - Referencing class attribute from another class attribute

In python, I want to have a class attribute which is a dictionary with initialized values. I wrote the code like the below. class MetaDataElement: (MD_INVALID, MD_CATEGORY, MD_TAG) = range(3) mapInitiator2Type = {'!':MetaDataElement.MD_CATEGORY, '#':MetaDataElement.MD_TAG} But when I try to run this c...

How to run GUI2Exe from command line?

I'm using GUI2Exe to CX_freeze my python app, which is working great... if I want to build it manually. My next step is to automate this build, so I can build in one step Is there a way to use the exported setup.py to build? or to call GUI2Exe with some command line parameters to build the project? Thanks! Update: So I ran the...

Optimal extraction of columns from numpy matrix

Say I have a numpy matrix like so: [[ x1, x2, x3, ... ], [ y1, y2, y3, ... ], [ z1, z2, z3, ... ], [ 1, 1, 1, ... ]] From which I want to extract a list of lists like so: [[x1, y1, z1], [x2, y2, z2], [x3, y3, z3], ... ] What is the most optimal way of doing this? At the moment I have: tpoints = [pt[:3].tolist() for pt in nu...

generate a folder to .nsi file use python

How to generate a folder to .nsi file use python thx! has any Library to do it? ...

Executing a function every 1 second

Possible Duplicate: Python timer countdown Hi guys, I want to know about timer in Python. Suppose i have a code snippet something like: def abc() print 'Hi' print 'Hello' print 'Hai' And i want to print it every 1 second. Max three times;ie; 1st second i need to check the printf, 2nd second I need to check as w...

Efficiently filter large number of datastore entities with a large number of property values

In my App Engine datastore I've got an entity type which may hold a large number of entities, each of which will have the property 'customer_id'. For example, lets say a given customer_id has 10,000 entities, and there are 50,000 customer_ids. I'm trying to filter this effectively, so that a user could get information for at least 2000 ...

Unable to get correct link in BeautifulSoup

I'm trying to parse a bit of HTML and I'd like to extract the link that matches a particular pattern. I'm using the find method with a regular expression but it doesn't get me the correct link. Here's my snippet. Could someone tell me what I'm doing wrong? from BeautifulSoup import BeautifulSoup import re html = """ <div class="entry">...

Python and/or django solution for reading log files on linux?

I would like my Django application to be able to display local syslog etc files. I would like to avoid writing the logic for managing .1,.2 etc rotated files, and get an object for each log that I can retrieve a set of rows from. Is there any such python library, or even better, any such django app? Clarification: I don't want to writ...

XML Question relating to Java and Python.

I am trying to write an application using Python 2.7 that will allow the user to open a dialog box, pick a file, have it read into a structure of some sort (ArrayList, List etc...) open to suggestions here and then to find basic statistical measures from the data (things like mean, standard deviation etc...) and to output the original fi...

how do I get a string format of the current date time, in python?

A string is returned July 5, 2010 ...

call program with arguments

i would like to start a python file (.py) with arguments and receive the output of it after it is finished. i have already heard about "popen" and "subprocess.call" but i could not find any tutorials how to use them does anyone know a good tutorial? ...

Need help with the regular expressions in Python

Hello. Help please to make from the string like: <a href="http://testsite.com" class="className">link_text_part1 <em>another_text</em> link_text_part2</a> string like: link_text_part1 another_text link_text_part2 using regular expressions in Python !note testsite.com changes ...

How can i include time interval between slides when converting ppt to swf using python and OO?

I found a script in Python that converts ppt to swf. But the timer that I have set in the ppt is not coming in the swf. What change should I bring in the script. The api reference didnt give me much help. The script is using uno module that comes with OO. ...

script for mounting an iso on another server

Hi i need to mount a iso on another linux system is there any way to send mount command to the linux system? Thanks ...

Paraview and Python on Mac OSX

I've installed the binary distribution of paraview on OSX. When running this I can access the python interpreter from the Tools -> Python Shell. However I cannot figure out which libraries I need to add to PYTHONPATH in order to access VTK and Paraview functionality directly from Python. Of course I could just compile the source distrib...