Hi all,
I'm trying to create a system in Python in which one can select a number of rows from a set of tables, which are to be formatted in a user-defined way. Let's say the table a has a set of columns, some of which include a date or timestamp value. The user-defined format for each column should be stored in another table, and querie...
I can load the fixture file in my django application by using loaddata:
manage.py loaddata palamut
The fixture palamut.yaml is in the directory palamut/fixtures/
I have a unit test module service_tests.py in palamut/tests/. Its content is here:
import unittest
from palamut.models import *
from palamut.service import *
from palamut....
Given a 1D array of values, what is the simplest way to figure out what the best fit bimodal distribution to it is, where each 'mode' is a normal distribution? Or in other words, how can you find the combination of two normal distributions that bests reproduces the 1D array of values?
Specifically, I'm interested in implementing this in...
I've got a python program where two variables are set to the value 'public'. In a conditional expression I have the comparison var1 is var2 which fails, but if I change it to var1 == var1 it returns True.
now if I open my python interpreter and do the same "is" comparison it succeeds
>>> s1 = 'public'
>>> s2 = 'public'
>>> s2 is s1
Tru...
So here's an interesting situation when using git and python, and I'm sure it happens for other situations as well.
Let's say I make a git repo with a folder /foo/. In that folder I put /foo/program.py. I run program.py and program.pyc is created. I have *.pyc in the .gitignore file, so git doesn't track it.
Now let's say I make anoth...
I have an "appliance" (for lack of better description) running linux.
Currently I ssh into the box to launch jobs. This isn't friendly enough for my users, so I'm putting together a simple web UI to launch the script. A job runs for anywhere from 10 seconds to several hours. The web UI needs to reflect the status of the job.
I've solve...
Hi I'm considering using Python to make a watchdog app on Windows XP that will perform the following actions:
Restart Windows at a given time.
Start an exe application.
Run a timer to check: is an application still running
I know of the existence of PyWin32, but I hear that the API is not complete. So my question is can Python perfor...
I have data that I want to represent visually. The actual data is a tree made up of nodes. Each node has a bunch of data associated with it, but as far as this question goes, I just want a way to represent a tree visually using Python. Any ideas?
The different solutions that popped in my head were to use a GUI library like WxPython or P...
I'm an intermediate PHP developer looking to take up a new language. I'm completely torn as to where to go at this point. There's so many languages related to web development and programming in general. I had might as well add Ruby to the question.
Java, Python, or stick with PHP and try to really master it? For those of you program...
I have an application that is sending a JSON object (formatted with Prototype) to an ASP server. On the server, the Python 2.6 "json" module tries to loads() the JSON, but it's choking on some combination of backslashes. Observe:
>>> s
'{"FileExists": true, "Version": "4.3.2.1", "Path": "\\\\host\\dir\\file.exe"}'
>>> tmp = json.load...
Wondering if this is possible in PHP Land:
Let's say I have a class as follows:
class myClass{
var $myVar;
...
myMethod(){
$this->myVar = 10;
}
}
and another class:
class anotherClass {
...
addFive(){
$this->myVar += 5;
}
}
The 'anotherClass' is 3500 lines long and I just want the single 'addFive' m...
I have a problem as follows:
Server process 1
Constantly sends updates that occur to a datastore
Server process 2
Clients contact the server, which queries the datastore, and returns a result
The thing is, the results that process 1 and process 2 are sending back the client are totally different and unrelated.
How does one deco...
Is there a way to make a portable/stand-alone exe for python apps?
I've read about p2exe but it doesn't support the latest version. I'm reluctant to go to 2.6 because I'd rather stay with the latest version instead of worrying about incompatibilities as soon as 2.6 becomes too outdated.
...
Hello,
I'm trying to querry blackle.com for searches, but I get an 403 HTTP error, can somebody point out what is wrong here?
#!/usr/bin/env python
import urllib2
ss = raw_input('Please enter search string: ')
response = "http://www.google.com/cse?cx=013269018370076798483:gg7jrrhpsy4&cof=FORID:1&q=" + ss + "&sa=Search"
urllib2....
I need to make an export like this in Python :
# export MY_DATA="my_export"
I've tried to do :
# -*- python-mode -*-
# -*- coding: utf-8 -*-
import os
os.system('export MY_DATA="my_export"')
But when I list export, "MY_DATA" not appear :
# export
How I can do an export with Python without saving "my_export" into a file ?
...
I am learning Python and, through the help of online resources and people on this site, am getting the hang of it. In this first script of mine, in which I'm parsing Twitter RSS feed entries and inserting the results into a database, there is one remaining problem that I cannot fix. Namely, duplicate entries are being inserted into one o...
I am using selenium with a python client. When doing selenium.delete_all_visible_cookies I get the exception:
ERROR: Command execution failure.
Please search the forum at
http://clearspace.openqa.org for error
details from the log window. The
error message is: malformed URI
sequence
The log window's error is:
error(125...
I already have a very simple threading XML-RPC server in Python:
from SocketServer import ThreadingMixIn
class AsyncXMLRPCServer(ThreadingMixIn, SimpleXMLRPCServer):
pass
server = AsyncXMLRPCServer(('localhost', 9999))
server.register_instance(some_object())
server.serve_forever()
Now I want to make it accessible exclusively over...
In the tornado documentation they show how they can have a very large through-put from 4 frontends. I'd like to run an app in the same way, and would like to have the frontends running as daemon processes managed with an init.d script*.
I'm fairly new to Python so don't really know where to start. Currently I'm starting the Tornado ser...
I'm trying to include the Google Website Optimizer JavaScript code, below, in a Zope3 page template. It's used for for A/B testing.
However, the template html parser, which I believe is the standard Python HTMLParser module, throws the following error:
raise PTRuntimeError(str(self._v_errors))
- Warning: Compilation failed
- Warning: <...