I have a script that generates some numbers (specifically times in epoch form).
Everytime it generates a number, I append the number to an array (called VALUES) and print both the array and that number. However, the number does not contain as many places after the decimal as the number in the array.
For example, a sample output will ...
I'm experience with Java, but I have to integrate a java library into a co-workers python code. Enter jython, yay!
We are trying to send a UDP packet with a very specific data section.
We are building up the packet like so:
version = 0x0001
referenceNumber = 0x2323
bookID = byteArray('df82818293819dbafde818ef')
For easy of explanati...
Hi,
how to install SSL for Python 2.5 on Debian?
I have tried:
sudo easy_install ssl
But getting:
python setup.py build
looking for /usr/include/openssl/ssl.h
looking for /usr/include/krb5.h
running build
running build_py
running build_ext
building 'ssl._ssl2' extension
creating build/temp.linux-i686-2.5
creating build/temp.linux-...
I have an executable called "foo" in "/home/myname/mydir/" and am trying to call it from Python, but I am doing something basic and wrong here. Can you help me?
import os, sys
sys.path.append("/home/myname/mydir/")
os.system("foo") # os.system("./foo") doesn't work either
Thanks
...
What is the best way to insure that only 1 copy of a python script is running? I am having trouble with python zombies. I tired creating a write lock using open("lock","w"), but python doesn't notify me if the file already has a write lock, it just seems to wait.
...
Hi, so I have a python script which takes the filename as a command argument and processes that file. However, because I have 263 files which need the same processing, I was wondering whether the command argument section could be modified with a for loop to consecutively run through all the files in a folder? Cheers, Sat
EDIT:
The code...
Hi,
I'm looking for a way to find the most dominant color/tone in an image using python. Either the average shade or the most common out of RGB will do. I've looked at the Python Imaging library, and could not find anything relating to what I was looking for in their manual, and also briefly at VTK.
I did however find a PHP script whic...
I have a global variable I called Y_VAL which is initialized to a value of 2.
I then have a function, called f() (for brevity), which uses Y_VAL.
def f():
y = Y_VAL
Y_VAL += 2
However, when trying to run my code, python gives the error message:
UnboundLocalError: local variable 'Y_VAL' referenced before assignment
If I re...
I currently use the following code to upload one file to a remote server:
import MultipartPostHandler, urllib2, sys
cookies = cookielib.CookieJar()
opener = urllib2.build_opener(MultipartPostHandler.MultipartPostHandler)
params = {"data" : open("foo.bar") }
request=opener.open("http://127.0.0.1/api.php", params)
response = request.read(...
hello everybody...
am looking for method and function watch i can search in web page !
ok I'll explain it :
i tell my python file .. go to www.example.com and search for that world "Hello guest"
and if my python file found that world "Hello guest" my python file print "the world found!"
and if he don't found he print "the world not found...
I hope I'm wrong, but it looks to me like the only way to have no help_text for a ManyToManyField is write an __init__ method for the form and overwrite self.fields[fieldname].help_text. Is that really the only way? I prefer to use CheckboxSelectMultple widgets, so am I really going to have to define an __init__ method for any form that ...
for number in range(1,101):
print number
Can someone please explain to me why the above code prints 1-100? I understand that the range function excludes the last number in the specified range, however, what is the 'number' part of the syntax?
I more used to C++ & Java where i'd write the code like:
for (i = 1; i<101; i++)
{return ...
I have a data set that I know has a Pareto distribution. Can someone point me to how to fit this data set in Scipy? I got the below code to run but I have no idea what is being returned to me (a,b,c). Also, after obtaining a,b,c, how do I calculate the variance using them?
import scipy.stats as ss
import scipy as sp
a,b,c=ss.pareto...
So, I have three numpy arrays which store latitude, longitude, and some property value on a grid -- that is, I have LAT(y,x), LON(y,x), and, say temperature T(y,x), for some limits of x and y. The grid isn't necessarily regular -- in fact, it's tripolar.
I then want to interpolate these property (temperature) values onto a bunch of dif...
Is there an analog of setattr() that allows for appending an arbitrary list property of an instantiated class object? If not, is there a recommended way of doing so?
This is a trivialized version of what I'm doing currently:
foo = SomeClass()
...
attr = "names"
value = "Eric"
values = getattr(foo, attr)
values.append(value)
setattr(foo...
I never thought I'd ever say this but I'd like to have something like the report generator in Microsoft Access. Very simple, just list data from a SQL query.
I don't really care what language is used as long as I can get it done fast.
C#,C++,Python,Javascript...
I want to know the quickest (development sense) way to display data from ...
I'm trying to do single sign-on (SSO) with an intranet web application written in Pylons and I'd like to use repoze.what for authorization. I have Apache configured with mod_sspi and it correctly authenticates the user and sets the REMOTE_USER environment variable. However, I can't figure out how to convince repoze.who that the user is,...
So I'm really new to programming, I just started learning Python yesterday and I'm having a little trouble. I've looked through a few tutorials and haven't come up with how to answer my question on my own, so I'm coming to you guys.
quickList = ["string1", "string2"]
anotherList1 = ["another1a", "another1b"]
anotherList2 = ["another2a"...
I am writing a data processing program in Python and R, bridged with Rpy2.
Input data being binary, I use Python to read data out and pass them to R, then collect results to output.
Data are organized into pieces, each being around 100 Bytes (1Byte per value * 100 values).
They just work now, but the speed is very low. Here are some o...
I cannot find a script to easily merge kml files; any ideas?
Ideally I'd like something along the lines of kmlmerge $file $file, as I'm already working on a shell script for managing multiple kismet drone nodes.
...