0 answers

Python.h header missing

I'm trying to figure out how to compile Python modules in C (http://docs.python.org/extending/extending.html), but the Python.h header file appears to be missing. I've installed all the python ...

1 min ago
4 answers

looping through a dictionary and printing it in a certain format

I have the following dictionary: # a small DB of people who stole my books dic = { 'Cohen' : 'Calvino' 'Evertt' 'Borges', 'Larry' : 'The Bible', 'Volanski' : 'Phone Book' } # here's an …

3 mins ago
2 answers

Homework - how to sort a dictionary

The problem is a list of room numbers and guest details I ripped straight from a txt file that needs to be put into a dictionary with the room number as the keys and the details as the values. The …

16 secs ago
0 answers

Python holding an webpage active

I am trying have a set of python scripts report their status to a set of micro controllers. So my idea for this is to have the python scripts each create their own webpage that can be viewed by the …

4 mins ago
2 answers

The Heroku's Python doesn't find redis(redistogo) for import

I've added the Redistogo add-on on Heroku,but I can't to test it out in the console mode. I have done this in accordance with the documentation. $ heroku run python --app redis-to-go Running python …

2 answers

When does python choose to intern a string

>>> s1 = "spam" >>> s2 = "spam" >>> s1 is s2 True >>> q = 'asdalksdjfla;ksdjf;laksdjfals;kdfjasl;fjasdf' >>> r = ...

2 answers

Isolate a value with BeautifulSoup in a bad written script

I am trying to parse the HTML source of a lot of different pages, like this one : http://www.ielts.org//test_centre_search/results.aspx?TestCentreID=dd50346f-60bc-4a4f-a37f-7e3d34df0bf8 or ...

1 answer

terminal output from Python's behave package

When I run the example feature shown on the pypi behave page the output isn't quite as I'd hoped: The Given, When and Then output messages are printed once in grey, once in colour. Also strange ...

6 mins ago
2 answers

Generating Links to Youtube Audio

I have been for a while now, as part of a larger project, trying to find a way to stream Youtube AUDIO into an application without downloading the corresponding file. What I have as of now is a ...

2 answers

Python Subclasses calling parent funciton

I some code like this class A(): class B(): def Foo(self): print "Hello" class C(): def Bar(self): print "Goodbye" def name(self): print ...

8 mins ago
3 answers

Arbitrary ordering of Django objects

Say I have series of book chapter objects, defined by this model: class Chapter(models.Model): heading = models.CharField() contents = models.TextField() And suppose I currently have four …

8 mins ago
1 answer

Python, printing things a select number of times

I'm new to coding and am having an issue with my program. I have to get sales information from a file and print it in a certain format. This is the code; #Looping program to read file per line for …

12 mins ago
1 answer

Bind a python library TO C

What I want to do is the opposite of what most people want to do: I have a library written in Python, and I want to make it available to C (and possibly other languages). I know that the typical ...

14 mins ago
4 answers

What is the simplest way to create an empty iterable using yield in Python?

I was playing around with iterables and more specifically the yield operator in Python. While using test driven development to start writing a new iterable, I wondered what is the shortest code that …

18 mins ago
0 answers

Can a FieldExpression within the Search API use custom functions?

The Google App Engine has previously released a Search API, that allows you to create Document objects, which can be searched within an indexing system similar to Googles search operations. One of …

2 answers

how to make text a class object in python

this is my entire code: from Graphics import * import random import time from Myro import * pt = Point(100,50) pink = makeColor(200,100,150) black = makeColor(0,0,0) red = makeColor(255, 0, 0) green …

19 mins ago
1 answer

Calculating crossing (intercept) points of a Series or DataFrame

I have periodic data with the index being a floating point number like so: time = [0, 0.1, 0.21, 0.31, 0.40, 0.49, 0.51, 0.6, 0.71, 0.82, 0.93] voltage = [1, -1, 1.1, -0.9, 1, -1, ...

20 mins ago
0 answers

Accessing variables from IPython interactive namespace in a script

Is there an easy way to access variables in the IPython interactive namespace. While implementing a project that has a slow load command, I would like to run a script to load the data into the ...

25 mins ago
1 answer

Randomised select in python, working unexpectedly

I'm trying to implement the rselect algorithm that I just learnt in class. However, cant seem to figure out where Im going wrong in the implementation. Here's my code def rselect(seq,length,i):# i …

26 mins ago
0 answers

The proper way to find xml node using libxml2 and xpath in python

I'm new to xml parsing in python. I've been playing around with libxml2 and xpath but unfortunately the documentation for that isn't very good. Suppose I have an xml doc which looks something like ...

28 mins ago
3 answers

Connecting to MySQL from Django

its my first project with django..i already tried the connection with sqlite.but now m using django's connection with mysql n m getting following error... D:\project\wogma>manage.py syncdb ...

32 mins ago
4 answers

Python - Example of urllib2 asynchronous / threaded request using HTTPS

I'm having a heck of a time getting asynchronous / threaded HTTPS requests to work using Python's urllib2. Does anyone out there have a basic example that implements urllib2.Request, ...

3 answers

Interpreting Django Source Code

I was looking through some of the Django source code and came across this. What exactly does: encoding = property(lambda self: self.file.encoding) do?

39 mins ago
0 answers

Python client producing and consuming JMS messages ( HornetQ)

I am very suprised that I have not found a solution so far. I have a Python program that needs to use JMS to produce and consume messages. The JMS provider is HornetQ. I have read about stomp ...

41 mins ago
1 answer

Python - Create a group of lists using numbers

say I have a string n = '22' and another number a = 4 so that n is a str and a is an int. I would like to create a group of lists like: list1 = [22, 12, 2] #decreasing n by 10, the last item must be …

1 answer

What is the most efficient way to display multiple pixmaps into a scroll area?

I am trying to make an application that displays a PDF file, using PyQt4 and python-poppler-qt4. So far I have managed to display the entire document by loading pixmaps generated with Poppler, set on …

47 mins ago
1 answer

Import Error for User Model

I have this piece of code which is running perfectly on localhost but throws up this obscure error on GAE: import_string() failed for 'webapp2_extras.appengine.auth.models.User' . Possible reasons …

0 answers

Twisted-PyQt4 segmentation faults

I'm using PyQt 4.9.1 on Ubuntu 12.04 (amd64) (tried with both python 2.6 and 2.7) to make a headless browser, but i'm getting: Program received signal SIGSEGV, Segmentation fault. Here is a simplified …

0 answers

unsplitting audio file in python

first of all I've never done any audio coding at all. I'm trying to see how to start on this little side project, Imagine this, you have an MP3 song split into three chunks, how can I compare the ...

1 hour ago
15 30 50 per page
1 2 3