I am trying to download mp3 file to users machine without his/her consent while they are listening the song.So, next time they visit that web page they would not have to download same mp3, but palypack from the local file. this will save some bandwidth for me and for them. it something pandora used to do but I really don't know how to.
...
I have a PyShell, which is supposed to be derived from wx.stc.StyledTextCtrl. How do I change the color scheme it uses?
...
There's a ton and and a half of questions and even more answers here concerning people looking for bug trackers. However all of them (that I found) seem to be about web based solutions. Since I'm working on a local project where I don't want to set up a web / DB server, and I don't want to use a hosted tracker either, I'm looking for som...
Hello, can you tell me how can I get a high precision sleep-function in Python2.6 on Win32 and on Linux?
...
Guys, my little code snippet throws the following Traceback:
..++++++++++++
..++++++++++++
Traceback (most recent call last):
File "csr.py", line 48, in <module>
csr.create_cert_signing_request(pubkey, cert_name)
File "csr.py", line 17, in create_cert_signing_request
cert_request.set_pubkey(EVP.PKey(keypair))
File "/usr/li...
Hello everyone,
I am using the TW for recaptcha, integrated everything as shown in the examples.
When sending the ReCaptcha to my template, my whole page output just cuts off.
I have traced back the problem to the javascript code in the widget.
It looks like this:
<script ....></script>
Only the dotted area contains some data, but t...
I have a list
a=[1,2,3,4,5]
and want to 'move' its values so it changes into
a=[2,3,4,5,1]
and the next step
a=[3,4,5,1,2]
Is there an build-in function in python to do that?
Or is there a shorter or nicer way than
b=[a[-1]]; b.extend(a[:-1]); a=b
...
Hello,
I've got a problem with executing a python script in different environments with different versions of the interpreter, because the way text is formatted differ from one version to another.
In python < 2.6, it's done like this:
n = 3
print "%s * %s = %s" % (n, n, n*n)
whereas in python >= 2.6 the best way to do it is:
n = 3...
Using Python I want to create a property in a class, but having the name of it in a string. Normally you do:
blah = property(get_blah, set_blah, del_blah, "bleh blih")
where get_, set_ and del_blah have been defined accordingly. I've tried to do the same with the name of the property in a variable, like this:
setattr(self, "blah", pr...
I want to make a function that detects if a method exists for given instance, what are the parameters that can be passed in and then call the method with proper parameters. I am novice and I have no idea how to do it :(
...
Hello everyone,
I just played around a little bit with python and threads, and realized even in a multithreaded script, DNS requests are blocking. Consider the following script:
from threading import Thread
import socket
class Connection(Thread):
def __init__(self, name, url):
Thread.__init__(self)
self._url = url
...
Is there a way for a python script to automatically detect whether it is being run interactively or not? Alternatively, can one detect whether ipython is being used versus the regular c python executable?
Background: My python scripts generally have a call to exit() in them. From time to time, I run the scripts interactively for debug...
Hi,
I have python threaded application + Postgres. I am using Django's ORM
to save to Postgres..
I have concurrent save calls. Occasionally 2 threads save with the
same primary key which leads to an issue.
Postgres log:
ERROR: duplicate key value violates unique constraint "store_pkey"
STATEMENT: INSERT INTO "store" ("store_id", "ad...
I'm using pygtk with PIL. I've already figured out a way to convert PIL Images to gtk.gdk.Pixbufs. What I do to display the pixbuf is I create a gtk.gdk.Image, and then use img.set_from_pixbuf. I now want to draw a few lines onto this image. Apparently I need a Drawable to do that. I've started looking through the docs but already I have...
Jython 2.5
I'm trying to bind a method to the focusGained event of a JText control, but all the examples that I found are Java samples, not Jython. Here's the code, I want to run a custom method when each text control gains focus (to select all the control's text, for instance)
from javax.swing import *
from java.awt import *
class Te...
I have an older version of python on the server i'm using and cannot upgrade it. is there a way to get the uuid module?
...
I have a python application that depends on the uuid module, but on the server where I need to run it, uuid is not installed. I do not have root on the server so I cannot place the uuid .pys in the /usr/lib/python2.4/site-packages folder... is there a way that I can utilize the .py's from elsewhere? like my ~ ?
...
I'm starting to learn python and loving it. I work on a Mac mainly as well as Linux. I'm finding that on Linux (Ubuntu 9.04 mostly) when I install a python module using apt-get it works fine. I can import it with no trouble.
On the Mac, I'm used to using Macports to install all the Unixy stuff. However, I'm finding that most of the pyth...
I'm trying to have python delete some directories and I get access errors on them. I think its that the python user account doesn't have rights?
WindowsError: [Error 5] Access is denied: 'path'
is what I get when I run the script.
I've tried
shutil.rmtree
os.remove
os.rmdir
they all return the same error.
...
Hi, I'm trying to remap several navigation keys:
ENTER: to work like standard TAB behavior (focus to next control)
SHIFT+ENTER: to work like SHIFT+TAB behavior (focus to previous control)
UP / DOWN arrows: previous /next control
etc
I tried with a couple of options but without luck:
from javax.swing import *
from java.awt import *
...