Hello,
I am learning Python by building a simple PyGTK application that fetches data from some SVN repositories, using pysvn. The pysvn Client has a callback you can specify that it calls when Subversion needs authentication information for a repository. When that happens, I would like to open a dialog to ask the user for the credential...
I have some doubt about python's class variables. As my understanding, if I define a class variable, which is declared outside the __init__() function, this variable will create only once as a static variable in C++.
This seems right for some python types, for instance, dict and list type, but for those base type, e.g. int,float, is no...
First, I am aware that dynamic languages is a term used mainly by a vendor; I am using it just to have a container word to include languages like Perl (a favorite of mine), Python, Tcl, Ruby, PHP and so on. They are interpreted but I am interested here to refer to languages featuring strong capability to support the programmer efficiency...
I'm an extension noob. What I want to do is create an extension that doesn't require other libraries to be installed. Is this impossible because the extension has to link against a specific version of libpython at runtime?
...
To implement != and == for my CPython extension type, should I implement tp_compare, tp_richcompare or both?
Under what circumstances is each of them called?
...
How do I go about opening a binary data file in Python and reading back the values one long
at a time, into a struct. I have something like this at the moment but I think this will keep overwriting idList, I want to append to it, so I end up with a tuple of all the long values in the file -
file = open(filename, "rb")
try:
...
Hello,
I have the following Django models
class ConfigurationItem(models.Model):
path = models.CharField('Path', max_length=1024)
name = models.CharField('Name', max_length=1024, blank=True)
description = models.CharField('Description', max_length=1024, blank=True)
active = models.BooleanField('Active', default=True)
...
Case 1
>>> datetime.__file__
'/usr/lib/python2.6/lib-dynload/datetime.so'
>>> print datetime.datetime.now()
2010-05-19 19:45:40.202634
Case 2
from django.db import models
import datetime
print datetime.__file__
print "--------------------------", datetime.datetime.now()
-----------Result--------
Development server is running at ht...
Hi,
I've a python script which works just as it should but I need to write the time for the execution. I've gooled that I should use timeit but I can't seem to get it to work.
My Python script looks like this:
import sys
import getopt
import timeit
import random
import os
import re
import ibm_db
import time
from string import maketran...
I am using this code to find files recursively in a folder , with size greater than 50000 bytes.
def listall(parent):
lis=[]
for root, dirs, files in os.walk(parent):
for name in files:
if os.path.getsize(os.path.join(root,name))>500000:
lis.append(os.path...
I'm having trouble coming up with a regular expression to match a particular case. I have a list of tv shows in about 4 formats:
Name.Of.Show.S01E01
Name.Of.Show.0101
Name.Of.Show.01x01
Name.Of.Show.101
What I want to match is the show name. My main problem is that my regex matches the name of the show with a preceding '.'. My reg...
is there a way to get the link from digg through its rss feed? or do i have to get the website and manually scrape it with a regex?
i want to get the real link digg points to, not to the comments feed, from rss.
example -
http://feeds.digg.com/~r/digg/popular/~3/Hx0VATaafSw/Apple_Scaling_Final_Cut_Studio_Apps_to_Fit_Prosumers_2
goes ...
Hello,
I would like to write a Python script which allows me to delete files from a FTP Server after they have reached a certain age. I prepared the scipt below but it throws the error message: WindowsError: [Error 3] The system cannot find the path specified: '/test123/*.*'
Do someone have an idea how to resolve this issue? Thank you...
I have a bit of Python code which depends on type checking. I'll try and phrase my problem in the language of math so it's clear. I have a few classes which correspond to subsets of each other and form an inheritance chain.
class Real(object):
pass
class Integer(Real):
pass
class Natural(Integer):
pass
And I have a tuple...
if I have a Customer object with a list of orders, declared using the db.ReferenceProperty
after a while I may have huge amount of orders in there, if I pull the Customer object would I be in danger of pulling the complete set of orders?
...
I'm confused. Consider this code working the way I expect:
>>> foo = u'Émilie and Juañ are turncoats.'
>>> bar = "foo is %s" % foo
>>> bar
u'foo is \xc3\x89milie and Jua\xc3\xb1 are turncoats.'
And this code not at all working the way I expect:
>>> try:
... raise Exception(foo)
... except Exception as e:
... foo2 = e
...
>>...
I have managed to create an online radio station using Shoutcast and Sam Broadcaster. Now, I am wanting to build my own player for that radio station. I am not sure where to begin, I have googled, but no luck. I am using Python 2.6 on Microsoft Windows.
I have managed to capture the stream and save it as an MP3 on the hard disk, just no...
I could use some help assigning to a global C variable in DLL using ctypes.
The following is an example of what I'm trying:
test.c contains the following
#include <stdio.h>
char name[60];
void test(void) {
printf("Name is %s\n", name);
}
On windows (cygwin) I build a DLL (Test.dll) as follows:
gcc -g -c -Wal...
Hello guys
I have this code, and I would like to use the app parameter to generate the code instead of duplicating it.
if app == 'map':
try:
from modulo.map.views import map
return map(request, *args, **kwargs)
except ImportError:
pass
elif app == 'schedule':
try:
from modulo.schedule.views ...
-
import time
import subprocess
from os.path import expanduser
chrome_path = expanduser('~\Local Settings\Application Data\Google\Chrome\Application\chrome.exe')
proc = subprocess.Popen(chrome_path)
time.sleep(4)
proc.terminate()
Output: WindowsError: [Error 5] Access is denied
How can I kill the Chrome process?
Python 2.6 on Win...