« first day (3 days earlier)      last day (31 days later) » 

10:59 AM
newest questions tagged python - Stack Overflow
1
votes
5
answers
Forcing a python script to take input from STDIN

KarthikA python script I need to run takes input only from an 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 mod...

python bash
newest questions tagged python - Stack Overflow
3
votes
3
answers
What is happening in this Python program?

jimmyc3poI'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): ...

python beginner iterator assignment
newest questions tagged python - Stack Overflow
2
votes
1
answers
Building a graph of the structure of an XML document

intuitedI'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 th...

python xml graph lxml dotfiles
newest questions tagged python - Stack Overflow
2
votes
1
answers
Python scene change detection

TerenoHi there, I am wondering if anyone has any experience with Python and video processing. Essentially, I would like to know if there are any libraries that would allow me to do scene detection in a video? If not, are there any that can allow me to split the video up into a series of fra...

python video video-processing
newest questions tagged python - Stack Overflow
1
votes
3
answers
dictionary and stack in python problem

ShilpaI have made a dictionary and I put the keys of the dict in a list. My list contains elements like this: s = [((5, 4), 'South', 1), ((4, 5), 'West', 1)] I made a dict from this: child = dict((t[0], t[1]) for t in s) keys = child.keys() print k...

python stack
newest questions tagged python - Stack Overflow
1
votes
3
answers
stack problem in python

Shilpas = [((5, 4), 'South', 1), ((4, 5), 'West', 1)] I want to put the (5,4) and (4,5) in to the stack. stack is already implemented in a file... so I am using : stack = search.Stack() Now I can use push and pop for stack. How to get the (5,4) and (4...

python stack
newest questions tagged python - Stack Overflow
0
votes
1
answers
Getting Python's nltk.wordnet module working for Jython.

gnucomHello, I've read through the FAQ for Jython and this post stackoverflow.com/questions/471000/jython-and-python-modules but am not sure how I can determine if a module is written purely in C or Pyth...

python jython python-module
newest questions tagged python - Stack Overflow
1
votes
1
answers
python 2.5.1 and supported version of xpath

tom smithhey.. trying to figure out how to determine what version of XPath is supported by python 2.4.3/2.5.1 using libxml2dom. in looking through various docs, i must be missing something! basically, i'm considering how/if i can have an XPath function, and use regex within the ...

python xpathengines
newest questions tagged python - Stack Overflow
0
votes
2
answers
how to create one-to-many relevance on google-app-engine

zjm1126like one forum has many topic , ths specific is : forum and topic has the same model : class Geo(db.Model): #self = db.SelfReferenceProperty() title = db.StringProperty() link = db.StringProperty() updated = db.DateTimeProperty(auto_now =True) autho...

python google-app-engine one-to-many listproperty
newest questions tagged python - Stack Overflow
2
votes
6
answers
Python: defining a union of regular expressions

learnerI have a list of patterns like list_patterns = [': error:', ': warning:', 'cc1plus:', 'undefine reference to'] what I want to do is to produce a union of all of them yielding a regular expression that matches every element in list_patterns [but pr...

python regex
newest questions tagged python - Stack Overflow
2
votes
4
answers
append tuples to a list

DGTHow can I append the content of each of the following tuples (ie, elements within the list) to another list which already has 'something' in it? So, I want to append the following to a list (eg: result[]) which isn't empty: l = [('AAAA', 1.11), ('BBB', 2.22), ('CCCC', 3.33)]

python
newest questions tagged python - Stack Overflow
1
votes
3
answers
python dictionary problem

Shilpaoutput of n is in the form:- ((6,5),'north',1) I am making a dict child for it...in which (6,5) is the key and north and 1 are the values. I need to keep the (6,5) as the key and north as a direction....and I...

python
newest questions tagged python - Stack Overflow
1
votes
1
answers
How do I force matplotlib to write out the full form of the x-axis label, avoiding scientific notation?

Mark C.Hello, I've created a simple hexbin plot with matplotlib.pyplot. I haven't changed any default settings. My x-axis information ranges from 2003 to 2009, while the y values range from 15 to 35. Rather than writing out 2003, 2004, etc., matplotlib collapses it into 0, 1, 2, ... + 2.00...

python matplotlib pyplot
newest questions tagged python - Stack Overflow
1
votes
1
answers
twisted callback function confusion

Joseph ArdenI'm working on a twisted tutorial just to learn more python and it seems I've ran into a road block here. The doRead() function below is the "callback" of a reactor. What I can't understand is how the except part works. The way I read the code is that if bytes += self.sock.recv(...

python twisted
newest questions tagged python - Stack Overflow
2
votes
3
answers
binary16 in Python

icktoofayThe struct module is useful when you're trying to convert data to and from binary formats. However, recently I came across a file format specification that uses

python struct floating-point format packing
newest questions tagged python - Stack Overflow
1
votes
6
answers
How can I "watch" a file for modification / change?

mederI would like to invoke my chrome or firefox browser when a file that I specify is modified. How could I "watch" that file to do something when it gets modified? Programmatically it seems the steps are.. basically set a never ending interval every second or so ...

python linux
newest questions tagged python - Stack Overflow
1
votes
1
answers
Relative imports clobber top-level imports?

Matt JoinerWhen doing an "from <> import *" in a package, the name <> is clobbered in the local namespace. Is this erroneous? Am I going about this all wrong? Here's the module contents: absolute_clobber_import/__init__.py from __future__ import absolute_import ...

python future absolute-import
newest questions tagged python - Stack Overflow
0
votes
2
answers
How to make a class field [list] read-only in python?

shmakovai have self.some_field = [] in my class Im enquiring is there a way to make this list read-only like a property?

python oop
newest questions tagged python - Stack Overflow
0
votes
2
answers
dictionary of 2 lists

ShilpaHow to create a dictionary of 2 lists. I want to use the elements of 1 list as key and another as value. Like I have a dictionary in which keys are (6,4) and values are (north, 1) It means each key has values that has 2 elements in it. I need to have only one i.e north .So that when I ...

python dictionary
newest questions tagged python - Stack Overflow
2
votes
1
answers
design workflow/flowchart representation in python ?

iamgopalIn my web application I have wizards with many next previous buttons and choices ( kind of flow chart with events and options ). Wizard do not run in one go, but may wait for external event, user come later or next day to carry on with that wizard. Currently I am manually writing code ( hard c...

python object-oriented-design workflow class-design flowchart
newest questions tagged python - Stack Overflow
4
votes
3
answers
how to combine exponents? (x**a)**b => x**(a*b)?

jed123how to simplify exponents in equations in sympy from sympy import symbols a,b,c,d,e,f=symbols('abcdef') j=(a**b**5)**(b**10) print j (a**(b**5))**(b**10) #ans even after using expand simplify # desired output a**(b**15) and if it is not possible with sym...

python simplify sympy exponents
newest questions tagged python - Stack Overflow
1
votes
1
answers
How do I do this with Django objects.filter?

alexMYTable.objects.filter( where id = 42, 55, 65, and 55) and it returns a query set ?

python mysql database django
newest questions tagged python - Stack Overflow
2
votes
3
answers
How would I determine zodiac / astrological star sign from a birthday in Python?

zenjiwebI am building a dating site in Django / Python. I have birthday dates and need to show what the person's Zodiac sign is based on their birthday. Anybody done this before? What would be the most efficient way of accomplishing this?

python django date-of-birth
newest questions tagged python - Stack Overflow
0
votes
0
answers
Why doesn't this Proxy server (written in python using asyncore) work?

Vivek NThis proxy server connects to another proxy server which is connected to the internet . The problem with this is that authentication etc works fine but the Server receives only the header from the remote server and not the HTML.How to fix this? please help USER='someUsername' ...

python networking proxy
newest questions tagged python - Stack Overflow
0
votes
2
answers
problem in dictionary python

ShilpaI made a dictionary, then split up the values and keys into lists and now its looks like this: keys = [(4,5),(5,6),(4,8)......so on]. values = [('west',1),('south',1).......] Then I made a new dictionary like in this way, final = dict((k,v[0]) ...

python dictionary
newest questions tagged python - Stack Overflow
1
votes
1
answers
How can I define a string in a python function?

Denis HoctorHi, I'm playing with Python and Google App Engine for the first time but am unable to define a string within my function (mytest2), I get an indentation error on the line after the declaration. I can define one in the parameters that works (test) but can't see why I wouldn't be able to...

python beginner google-app-engine indentation syntax-error
newest questions tagged python - Stack Overflow
2
votes
2
answers
Error in executing python code- dictionary problem

Shilpawhile stack.isEmpty() != 1: fin = stack.pop() print fin - output is (1,1) k = final.get(fin) return k def directionToVector(direction, speed = 1.0): dx, dy = Actions._directions[direction] return (dx * speed, dy * speed) di...

python dictionary
newest questions tagged python - Stack Overflow
0
votes
0
answers
How to write a twisted server that is also a client?

MarconiHello, How do I create a twisted server that's also a client? I want the reactor to listen while at the same time it can also be use to connect to the same server instance which can also connect and listen.

python twisted
newest questions tagged python - Stack Overflow
5
votes
3
answers
Reason for "all" and "any" result on empty lists

detlyIn Python, the built-in functions all and any return True and False respectively for...

python
newest questions tagged python - Stack Overflow
0
votes
2
answers
Am I parsing this HTTP POST request properly?

Carson MyersLet me start off by saying, I'm using the twisted.web framework. Twisted.web's file uploading didn't work like I wanted it to (it only included the file data, and not any other information), cgi.parse_multipart doesn't work like I want it to (same thing, ...

python http parsing file-upload twisted.web
newest questions tagged python - Stack Overflow
0
votes
1
answers
Is there an equivalent to python's urllib in c/c++ ?

liquifany c/c++ library out there that provides functions like getUrl, urlopen, post etc. ?

c++ python url
newest questions tagged python - Stack Overflow
0
votes
0
answers
Compiling .go ( google go language ) in Windows ... & Can python connect to Go ?!

SalehHi all, i know that go language does not support windows yet, now, how can i compile .go file is windows ? and can python connect to go ? like connecting c++ or java to python ... lol

python google programming-languages go
 
11:21 AM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Hiding console window of Python GUI app with py2exe

Ahmet Alp BalkanI have a Python program uses Qt (PyQt4 in fact) and when I launch it from its main.py, I get a console window and the GUI window (on Windows, of course). Then I compile my program with py2exe and main.exe is successfully created. However, if I run main.exe (this is what users of progra...

python pyqt pyqt4 py2exe
 
11:32 AM
newest questions tagged python - Stack Overflow
0
votes
0
answers
string mask and offset with regex

aconradI have a string on which I try to create a regex mask that will show N number of words, given an offset. Let's say I have the following string: "The quick, brown fox jumps over the lazy dog." I want to show 3 words at the time: offset 0

python regex regex-negation
 
 
2 hours later…
1:25 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
python 3.x speech module

bahHi, Is there pyTTS or some kind of speech module for python 3.0? I can't seem to find it anywhere and I'd really like to try it out.

python windows speech
 
2:02 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
python/xpath guru issue?

tom smithhi. using python 2.4/2.5, with libxm2dom. trying to get my haead around a question/issue that i'm considering. i have a doc i import the doc, and can build the dom (libxml2dom) i'm trying to figure out if there's a way to programatically "search" for a given te...

python xpath libxml2
 
 
1 hour later…
3:07 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
How can I use the python HTMLParser library to extract data from a specific div tag?

MartinI am trying to get a value out of a HTML page using the python HTMLParser library. The value I want to get hold of is within this html element: ... <div id="remository">20</div> ... This is my HTMLParser class so far: class LinksPar...

python html parsing html-parsing
 
3:40 PM
newest questions tagged python - Stack Overflow
1
votes
0
answers
Adding options which both change behaviour and store an argument

intuitedUsing the argparse module, is it possible to perform multiple actions for a given argument? Specifically, I'd like to provide a -l/--list option with nargs='?' that will change the behaviour of the program from its main function to on...

python argparse
 
3:50 PM
newest questions tagged python - Stack Overflow
1
votes
0
answers
Extracting date from a string in Python

dmpopHow can I extract the date from a string like "monkey 2010-07-10 love banana"? Thanks!

python string date
newest questions tagged python - Stack Overflow
0
votes
0
answers
Using Web2Py in Making a blog in Python (Google App Engine)? Is it a good Idea?

laughing-manI know there are tons of blogging platforms out there (Wordpress,Drupal,etc) but I want to make my own blog engine or blog platform from scratch using python as a learning tool. The idea of using Google App Engine solves the issues in hosting. Blogs relatively consumes less amount of disk spac...

python google-app-engine blogging web2py
 
4:12 PM
newest questions tagged python - Stack Overflow
0
votes
1
answers
Basic data storage with Python

erkangurI need to store basic data of customer's and cars that they bought and payment schedule of these cars. These data come from GUI, written in Python. I don't have enough experience to use a database system like sql, so I want to store my data in a file as plain text. And it doesn't have to be on...

python database data-storage
 
5:06 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Python Popen: are the pipes in blocking mode? how can I put them in non-blocking mode?

AlbertHi, In the subprocess documentation, I haven't found any hint if the pipes created by PIPE are blocking or non-blocking. I.e., if I call p.stdout.read(), will it block in certa...

python pipes blocking popen nonblocking
 
5:23 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Twisted and enabling command line history

AntonisIn a previous question of mine i get this answer: Subclass twisted.conch.recvline.HistoricRecvLine instead of twisted.protocols.basic.LineReceiver. keystrokeReceived is one of the several additional protocol callbacks available when you are using a terminal instead of a TCP connection....

python twisted
newest questions tagged python - Stack Overflow
0
votes
0
answers
Execute Python program using PHP

ssdesignHi, Can I simply execute Python program using PHP like this? (in a browser) exec("python myProgram /Applications/MAMP/htdocs/somefile.xml"); or like this: exec("/path/to/python path/to/myProgram /Applications/MAMP/htdocs/somefile.xml"); ...

php python
 
5:33 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Python Persecution?

lord britishWhy Hidden features of Python has been closed and ... Hidden Features of JavaScript

python stackoverflow
newest questions tagged python - Stack Overflow
0
votes
1
answers
Does python yield imply continue?

345871345I have a for loop that checks a series of conditions. On each iteration, it should yield output for only one of the conditions. The final yield is a default, in case none of the conditions are true. Do I have to put a continue after each block of yields? def functio...

python generator yield
newest questions tagged python - Stack Overflow
0
votes
0
answers
why model has the key_name don't has the key().id() on google-app-engine

zjm1126if i use this : class A(db.Model): a=db.StringProperty() class demo(BaseRequestHandler): def get(self): a=A() a.a='sss' a.put() raise Exception(a.key().id()) i can get the a.key().id() is 961 but if i add key_na...

python google-app-engine key
 
5:55 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
execute functions in a queue

killownhi! i have a example who should show what i'd like to do queue = 2 def function(): print 'abcd' time.sleep(3) def exec_times(times): #do something function() def exec_queue(queue): #do something function() exec_times(3) #things need be working while ...

python
 
6:11 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
How to get the number of args of a built-in function in Python?

culebrónI need to programmatically get the number of arguments that a function requires. With functions declared in modules this is trivial: myfunc.func_code.co_argcount But built-in functions don't have the func_code attribute. Is there another way to do...

python
 
6:22 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
What's the fastest way to encrypt a string using AES in python on Google App Engine?

Denis HoctorHi, I have a string I need to encrypt using AES in CBC mode with zero padding, before finally encoding it to base64. I've got my initialisation vector. What would be the fastest (and easiest) way to do this on Google App Engine in Python? Thanks, Denis

python google-app-engine aes
 
6:39 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
how to Reference the variable via db.run_in_transaction on google-app-engine .

zjm1126this is my code: class A(db.Model): a=db.StringProperty() class demo(BaseRequestHandler): def get(self): a='' def fn(): global a a=A(a='www') a.put() db.run_in_transaction(fn) raise Exception(a.key()) ...

python google-app-engine transaction
 
7:28 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Set Django ModelForm visible fields at runtime?

andrewI have a Django model: class Customer(models.Model): first_name=models.CharField(max_length=20,null=True, blank=True) last_name=models.CharField(max_length=25,null=True, blank=True) address=models.CharField(max_length=60,null=True, blank=True) address2=models.CharField(...

python django runtime models modelform
newest questions tagged python - Stack Overflow
0
votes
0
answers
MySQL: conduct a fuzzy search

JimI have a names table in my database and I would wish to conduct a fuzzy search on it for example my database contains: Name ID John Smith 1 Edward Smith 2 Gabriel Gray 3 Paul Roberts 4 Sorry I dont know how to mak...

python mysql
 
7:44 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Pyhon, is it possible to mix generator and a recursive function ?

lord britishIs there a way to make the something like the following code work? add = lambda n: (yield n) or add(n+1) (answers don't need to be in functional style)

python generator recursive
 
8:06 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Fabric auto-login in Windows

Tal WeissRelevant question: stackoverflow.com/questions/2339735/fabric-password I configured Putty to login with private-public keys (no password) using this guide:

python windows ssh fabric paramiko
newest questions tagged python - Stack Overflow
0
votes
0
answers
Implementing class descriptors by subclassing the `type` class

intuitedI'd like to have some data descriptors as part of a class. Meaning that I'd like class attributes to actually be properties, whose access is handled by class methods. It seems that Python doesn't directly support this, but that it can be implemented by subclassing the type

python class properties class-attributes descriptors
newest questions tagged python - Stack Overflow
0
votes
0
answers
Django - Custom dashboard view authentication issues

ScoopDjango version 1.1.1 I have a custom dashboard view set up to override the django admin default like: (r'^admin/$', 'dashboard.views.dashboard'), (r'^admin/', include(admin.site.urls)), dashboard view authenticates with the @staff_member_required decorator...

python django django-admin
newest questions tagged python - Stack Overflow
0
votes
0
answers
how to parse the remainder: [0] on google-app-engine .

zjm1126my code is : class demo(BaseRequestHandler): def get(self): a=[[1,2,3],[3,6,9]] self.render_template('map/a.html',{'geo':a}) and the html is : {% for i in geo %} <p><a href="{{ i[0] }}">{{ i[0]}}</a&g...

python google-app-engine array
 
8:54 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
extend/append list

DGTI would like to either extend or append a list to the content of another list: I've got the following: l = (('AA', 1.11), ('BB', 2.22), ('CC', 3.33)) ls = [('XX', 7.77), ('YY', 8.88), ('ZZ', 9.99)] m = ['first', 'second', 'third'] for i in range(len(l)): result = [] for...

python
 
9:05 PM
newest questions tagged python - Stack Overflow
1
votes
0
answers
Speeding up regular expressions in Python

AbhiI need to quickly extract text from HTML files. I am using the following regular expressions instead of a full-fledged parser since I need to be fast rather than accurate (I have more than a terabyte of text). The profiler shows that most of the time in my script is spent in the re.sub procedu...

python regex optimization
 
9:27 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Possible to pass more than 1 argument to a context processor in Django?

sizeightIs it possible to pass more than 1 argument to a context processor in Django? In other words, in addition to the HttpRequest object, I would like to pass 1 or more additional argument?

python django
 
9:43 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
How does python's super() work with multiple inheritance?

CallistoHi I'm pretty much new in python object oriented programming and I have troubles understanding the super() function (new style classes) especially when it comes to multiple inheritance. For example if you have something like: class First(object): def __init__(self): ...

python multiple-inheritance
newest questions tagged python - Stack Overflow
0
votes
0
answers
Is Python-based software considered less-professional than C++/compiled software?

JakobudI'm working on a plugin for some software that I'm planning on selling someday. The software I'm making it for has both a C++ SDK and a Python SDK. The C++ SDK documentation appears incomplete in certain areas and isn't documented that well. The Python SDK docs appear more comp...

c++ python
 
9:54 PM
newest questions tagged python - Stack Overflow
http://stackoverflow.com/questions/3277404/python-object-oriented-model
 
10:16 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Django comment moderation error: AlreadyModerated at /

GroadyI'm trying to add the comments framework to a weblog I'm creating in Django. Adding the comments system appears to be working fine until I attempt to enable comment moderation. I add the ...

python django
 
10:27 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
python read file line by line into array

Julie RaswickHow do I read every line of a file in python and store each line as an element in an array? I want to read the file line by line and each line is appended to the end of the array. I could not find how to do this anywhere and I couldn't find how to create an array of strings in python.

python beginner string file array
 
10:59 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Looking for a good python framework for web apps (w/threading support)

jahmaxI am looking for a good framework for building web apps in python (could also be python + php). The apps will make http requests (GET/POST) and process data, so I'd like to have threading support to make it faster.

python web-development web-applications frameworks framework
 
11:26 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
How deploy Flask application on Webfaction?

esauritoAnybody know how to deploy a simple Flask application on Webfaction? I know Webfaction support mod_wsgi and I read the guide on the Flask site but still I can't make my app working. Anybody have a working configuration? Thanks.

python flask
 

« first day (3 days earlier)      last day (31 days later) »