Hi,
I have some code:
l1 = clutter.Label()
l1.set_position(100,100)
for i in range(0,10):
l1.set_text(str(i))
time.sleep(1)
That is designed to show a count from 1 to 10 seconds on the screen in clutter, but I'm getting a strange error. When I run the script normally the screen runs as it should do, but there is no text displayed u...
I have done a decorator that I used to ensure that the keyword arguments passed to a constructor are the correct/expected ones. The code is the following:
from functools import wraps
def keyargs_check(keywords):
"""
This decorator ensures that the keys passed in kwargs are the onces that
are specified in the passed tuple. When applied...
I want my setup.py to do some custom actions besides just installing the Python package (like installing an init.d script, creating directories and files, etc.) I know I can customize the distutils/setuptools classes to do my own actions. The problem I am having is that everything works when I cd to the package directory and do "python s...
Hi Everyone,
I have recently been learning python and have run into a problem when uploading files larger than 1-2mb with cgi.
I am building a file uploader with a progress bar that updates with ajax. Everything is working great for smaller files and for larger files once it gets past the line:
form = cgi.FieldStorage()
I think ...
This question covers a broad range of programming languages; however, I am specifically working with Python in this case.
I would like to create some user defined exceptions, but I'm not sure how fine-grained they should be. For example, if I have the following class:
class Race(object):
def __init__(self, start_time, end_time):
...
Is it possible to encapsulate python modules 'mechanize' and 'BeautifulSoup' into a single .py file?
My problem is the following:
I have a python script that requires mechanize and BeautifulSoup. I am calling it from a php page. The webhost server supports python, but doesn't have the modules installed. That's why I would like to do thi...
I've been using Werkzeug to make WSGI compliant applications. I'm trying to modify the code in the front page.
Its basic idea is that you go to the /hello URL and you get a "Hello World!" message. You go to /hello/ and you get "hello !". For example, /hello/jeff yields "Hello Jeff!". Anyway, what I'm trying to do is putting a form in th...
Hi,
In my application, we want to present the user with a typical spreadsheet/table (OO.O/Excel-style), and then pull out the values and do something with them internally.
Is there a preexisting widget for PyGTK that does this? The PyGTK FAQ mentions GtkGrid, but the link is dead and I can't find a tarball anywhere.
...
I have related tasks from two Org files/subtrees where some of the clocked time overlaps. These are a manual worklog and a generated git commit log, see below.
One subtree's CLOCK: entries needs to be adjusted to remove overlapping time. The other subtree is considered complete, and it's CLOCK: entries should not be adjusted.
EDIT: Thi...
I am using the standard json module in python 2.6 to serialize a list of floats. However, I'm getting results like this:
>>> import json
>>> json.dumps([23.67, 23.97, 23.87])
'[23.670000000000002, 23.969999999999999, 23.870000000000001]'
I want the floats to be formated with only two decimal digits. The output should look like this:
...
If a would-be-HTTP-server written in Python2.6 has local access to a file, what would be the most correct way for that server to return the file to a client, on request?
Let's say this is the current situation:
header('Content-Type', file.mimetype)
header('Content-Length', file.size) # file size in bytes
header('Content-MD5', file.hash...
I have installed python from .msi installer in windows and installed a lot of other modules. i would like to have all these available on a portable thumbdrive, but i don't want to redownload all the extramodules. Is there a way i can convert my C:\python26* to a portable python installation?
...
I found this class to take a space delimited file and if there are multiple spaces, they will be treated as a single separator. How do I see the effects of this on a file?
class FH:
def __init__(self, fh):
self.fh = fh
def close(self):
self.fh.close()
def seek(self, arg):
self.fh.seek(arg)
de...
Does anyone know of a way to make/read symbolic links across versions of win32 from Python? Ideally there should be a minimum amount of platform specific code, as I need my app to be cross platform.
...
I am trying to pass an image over python socket for smaller images it works fine but for larger images it gives error as
socket.error: [Errno 10040] A message sent on a datagram socket was larger than
the internal message buffer or some other network limit, or the buffer used to receive a datagram into was smaller than the datagram itse...
So I have two models...
Parent and Child.
Child extends Parent.
When I do
Parent.objects.all(), I get both the Parents and the Children.
I only want Parents
Is there a Parent.objects.filter() argument I can use to only get the Parent objects instead of the objects that extend parent?
...
I am running Mac OS X 10.5.8. I have installed Python 2.6 from the site. It's in my application directory. I have edited my .bash_profile to have:
# Setting PATH for MacPython 2.6
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.6/bin:${PATH}"
export PATH
export PATH=/usr/lo...
Editing because the initial code was confusing.
I would assume these two things to be same,
#I would use either of these
#Option 1
def bar(*args):
pass
foo = deco(bar)
#Option2
@deco
def foo(*args):
pass
However if the decorators deco has side effects, this is not guaranteed. In partcicular, this was my ecpectation form a de...
Anybody out there who have tried to use JQGrid a Jquery plugin with django?
Please share your knowledge/code samples
Gath
...
I have a simple programs for socket client and server its not working over internet
# Echo server program
import socket
import ImageGrab
HOST = '' # Symbolic name meaning all available interfaces
PORT = 3000 # Arbitrary non-privileged port
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((HOST, ...