I am working with a shared hosting environment which as well as other things supports Python. I have followed the examples and deployed my cgi file and then through chmod, gave it Read and Execute Permissions to the world and then Read, Write and Execute to the owner.
The code is simply this:
#!/usr/bin/python
# Required header that ...
I have the beginnings of a small multiplayer game that I'm writing in python as a learning exercise. Currently the server runs at 10 fps, while the clients run at whatever rate they like. This works well to conserve bandwidth, but unless the client tells the server when its input happened, all input gets quantized to 100ms intervals. How...
I am trying to run the script csv2json.py in the Command Prompt, but I get this error:
C:\Users\A\Documents\PROJECTS\Django\sw2>csv2json.py csvtest1.csv wkw1.Lawyer
Converting C:\Users\A\Documents\PROJECTS\Django\sw2csvtest1.csv from CSV to JSON as C:\Users\A\Documents\PROJECTS\Django\sw2csvtest1.csv.json
Traceback (most recent call la...
I was wondering what the simplest way to convert a string list like
x =u'[ "A","B","C" , " D"]'
-in case user puts spaces in between the commas , and spaces inside of the quotes . I need to handle that as well
to
x = ["A","B","C","D"]
in python.
I know I can strip spaces with strip and split using the split o...
I'm trying to use the subprocess module with Python 2.6 in order to run a command and get its output. The command is typically ran like this:
/usr/local/sbin/kamctl fifo profile_get_size myprofile | awk -F ':: ' '{print $2}'
What's the best way to use the subprocess module in my script to execute that command with those arguments and ...
If I draw any shape onto a surface (with SRCALPHA flag on) in a partially transparent colour it completely replaces what was underneath it, instead of overlapping like you would expect in image editors.
How can I make the shapes overlap properly?
...
Is it possible to dynamically determine the name of a variable in Python?
For example, I sometimes have the following situation:
name = foo if bar else baz
type = alpha or bravo
D = {
"name": name,
"type": type
}
It would be nice if duplication there could be reduced with something like D = makedict(name, type).
Somewhat re...
I'm trying to see how I can get a python script to run in the web browser. Does anyone know if this is possible or would I need to make a plugin?
I'm looking for something that would work like:
<embed type="application/x-python" src="myscript.py"></embed>
Thanks,
Joe
...
This thread got too confusing (for me) so I am asking the question again. I could not make the csv2json.py script mentioned in the original question work. I am just trying to find a way to import data to sqlite3 database.
Here's the model I am working with:
from django.db import models
class School(models.Model):
school = mode...
Can I use python lxml on google app engine? ( or do i have to use Beautiful Soup? )
I have started using Beautiful Soup but it seems slow. I am just starting to play with the idea of "screen scraping" data from other websites to create some sort of "mash-up".
...
Hi all,
I'm trying to filter certain data from an HTML file. For example, the HTML file is as follows:
<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]">software_0.1-0.log</td><td align="right">17-Nov-2009 13:46 </td><td align="right">186K</td></tr>
I need to extract the software_0.1-0 part as well as the 17-Nov-2009 par...
Hello,
To begin with, this question is not a dup of this one, but builds on it.
Taking the tree in that question as an example,
1
/ \
2 3
/ / \
4 5 6
How would you modify your program to print it so,
1
2 3
4 5 6
rather than the general
1
2
3
4
5
6
I'm basically looking for intuitions on the most efficie...
There are actually a couple of questions here. For what I'm doing, I'm doing a basic image upload with Django 1.1 and Google App Engine. Here is my form class:
class UploadPictureForm(forms.Form):
picture = forms.ImageField()
And then on submit, I have the following code:
def handle_picture(request):
form = UploadPictureFor...
Hello -
I want to create a massive TimeSeries object which will hold 1000 different financial markets data series, each storing 1500 daily-data points. I'm quite new to the TimeSeries module and am a little confused as to how I would best go about it. So a few basic questions:
1) Should I use a huge numpy array of 1000x1500 and simply...
I'm trying to create regular expressions to filter certain text from a text file. What I want to filter has this format:
word_*_word.word
So for example, I would like the python code every match. Sample results would be:
program1_0.0-1_log.build
program2_0.1-3_log.build
How can I do this?
Thanks a lot for your help
...
Hello,
This question is running a danger of being marked as already asked. I've went through similar posts on stackoverflow and other sites and was not able to find an exact answer.
I am planning to write a simple web service which will be an interface to a cloud storage such as S3. In addition it will perform various simple validation...
Hello,
PHP provides mysql_connect() and mysql_pconnect() which allow creating both temporary and persistent database connections.
Is there a similar functionality in Python? The environment on which this will be used is lighttpd server with FastCGI.
Thank you!
...
I'm having an interesting problem with threads and the tempfile module in Python. Something doesn't appear to be getting cleaned up until the threads exit, and I'm running against an open file limit. (This is on OS X 10.5.8, Python 2.5.1.)
Yet if I sort of replicate what the tempfile module is doing (not all the security checks, but jus...
I'm attempting to use Pymacs with rope/ropemacs for flymake syntax checking as described here:
http://www.enigmacurry.com/2009/01/21/autocompleteel-python-code-completion-in-emacs/
When I start Carbon Emacs "normally" it throws the error:
error: Pymacs loading ropemacs...failed
I had this working on OSX 10.5 with Carbon Emacs but it f...
I have the following Bird definition:
class Bird:
def __init__(self, swarm, position = None):
if (swarm == None):
raise ValueError("swarm variable should not be None!")
if (not(type(swarm)).__name__ == 'ParticleSwarmOptimization'):
raise TypeError("swarm variable must be of type ParticleSwarm...