Hello. I am running Ubuntu 10.04, I have python installed and running fine. When I installed pand3d from the deb package from the site and tried to run an sample. Like it is describe in this page:
http://www.panda3d.org/manual/index.php/Installing_Panda3D_in_Linux
I got the error:
Traceback (most recent call last):
File "T...
I have an OpenCV project mixing Python and C. After changing to OpenCV 2.1, my calls to C code are not working any more, probably because OpenCV is no more using SWIG bindings.
From Python, I was used to call a C function with the following prototype:
int fast_support_transform(CvMat * I, CvMat * N,...);
Now, I get the following err...
Dear Stackoverflow,
I'm wondering how to reproduce the equivalent of a make -j<n> on a setup.py using distutils.Extension, in order to build a C extension to Python 2.6 .
My desired outcome: having setup.py build using a few instances of my C-compiler in the same time, instead of only one.
There are probably an environnement var or tw...
I'm using this line in a SPARQL query in my python program:
FILTER regex(?name, "%s", "i" )
(where %s is the search text entered by the user)
I want this to match if either ?name or ?featurename contains %s, but I can't seem to find any documentation or tutorial for using regex(). I tried a couple things that seemed reasonable:
FILT...
Hi,
I am writing a system of comments in DJango and I want to authenticate my users with OpenID.
I see a lot of solutions that integrate DJango and OpenID, but all of these consist on a login form.
I don't want to provide a login form to my users (in fact, i don't want to have a users table).
In my comment form there is a URL field. ...
Hi fellow stackies.
I am a Python newbie. I have this small problem. I want to print a list of objects but all it prints is some weird internal representation of object. I have even defined __str__ method but still I am getting this weird output. What am I missing here?
class person(object):
def __init__(self, name, age):
self.na...
In python regex how would I match against a large string of text and flag if any one of the regex values are matched... I have tried this with "|" or statements and i have tried making a regex list.. neither worked for me.. here is an example of what I am trying to do with the or..
I think my "or" gets commented out
patterns=re.compi...
for predefined equations,assigning new values to variables do not changes value of equation.
how can i assign new values to variables so that i will get appropriate value of equation and not the previous one
a,b,c,d,e,f=sympy.symbols('abcdef')
a,b=c,d
e=a+b #equation
print e
c+d #value of eqn
a,b=d,f
print e
c+d #not d+f
...
Hello, I'm trying to get into Python and, more specifically, Zope and Plone. I read the book Professional Plone Development and one thing it says is that one MUST use version control. But the book did not expand on that topic any further. This leads to two questions.
First: SVN or git? (My research points to git, if only to learn it. I'...
I plan to organize my python project the following way:
<my_project>/
webapp/
mymodulea.py
mymoduleb.py
mymodulec.py
mylargemodule/
__init.py__
mysubmodule1.py
mysubmodule2.py
backend/
mybackend1.py
myba...
Running OSX 10.6.3
Just updated python to Python 2.6.5 (r265:79359
rebuilt and reinstalled mysqldb (MySQL-python-1.2.3)
rebuilt and reinstalled django (<-- should be unrelated. problem seems to be with mysqldb)
I'm getting the following error.
File "<stdin>", line 1, in <module>
File "build/bdist.macosx-10.3-fat/egg/MySQLdb/__init_...
so lets say I have a simple class Final and I want to filter the results for the past 2 days by the created field, how do I do this? When I populate the final class it has a utc created time, but I need the difference of that time and currently this is along the line of what I want done below, but I am unsure on how to get a difference i...
I need a wxPython preference dialog box from a Python application. I could hand-code it (and use wxGlade to do part of the job), but I was wondering if there is no tool that makes creation of simple preference dialog boxes easier.
The 'easier' part would be in that you can specify that you need e.g. a text box, and both the GUI elements...
I am confused by this behaviour of Python(2.6.5), can someone shed light on why this happens?
class A():
mylist=[]
class B(A):
j=0
def addToList(self):
self.mylist.append(1)
b1 = B()
print len(b1.mylist) # prints 0 , as A.mylist is empty
b1.addToList()
print len(b1.mylist) # prints 1 , as we have added to A....
this is my model:
class Geo(db.Model):
entry = db.ListProperty(db.Key)
geo=Geo()
geo.entry.append(otherModel.key())
and the html is :
{% for i in geo.entry %}
<p><a href="{{ i.link }}">{{ i.title }}</a></p>
{% endfor%}
but it show nothing,
i think maybe should :
class Geo(db.Model):
entry = db.ListProperty(db.Mod...
I have a QWebView, which works fine. Then, using code from spynner, I attempt to bind the useragent method to a custom method. This appears to work in spynner (with a QWebPage), but not here. Any help much appreciated. Code:
def customuseragent(url):
print 'called for %s' % url
return 'custom ua'
#inside a class
self.webkit = QtWebK...
I want to create an array with dtype=np.object, where each element is an array with a numerical type, e.g int or float. For example:
>>> a = np.array([1,2,3])
>>> b = np.empty(3,dtype=np.object)
>>> b[0] = a
>>> b[1] = a
>>> b[2] = a
Creates what I want:
>>> print b.dtype
object
>>> print b.shape
(3,)
>>> print b[0].dtype
int64
b...
A python script I need to run takes input only from a file passed as a command line argument, like so:
$ markdown.py input_file
Is there any way to get it to accept input from STDIN instead? I want to be able to do this through Bash, without significantly modifying the python script:
$ echo "Some text here" | markdown.py
If I have ...
I'd like to know what is getting assigned to what in line 8.
# Iterators
class Fibs:
def __init__(self):
self.a = 0
self.b = 1
def next(self):
self.a, self.b = self.b, self.a+self.b # <--- here
return self.a
def __iter__(self):
return self
fibs = Fibs()
for f in fibs:
if f > 100...
I'd like to build a graph showing which tags are used as children of which other tags in a given XML document.
I've written this function to get the unique set of child tags for a given tag in an lxml.etree tree:
def iter_unique_child_tags(root, tag):
"""Iterates through unique child tags for all instances of tag.
Iteration st...