Hi folks
I'm working on a server-side project that consists of several services. Each service is run in interactive (i.e. non-daemon) mode, this is handy while active development. The project is in virtualenv. So the typical way to start a service is:
$ cd ~/to/vitualenv/subdir/where/service/code/located
$ source ../path/to/virtualenv/...
gtk.Paned contains a style property called 'handle-size' which i assume will change the size of the handle, it's read only, so how do i change it?(in PyGtk)
...
IllegalStateException is often used in Java when a method is invoked on an object in inappropriate state. What would you use instead in Python?
...
the list.index(x) function returns the index in the list of the first item whose value is x.
is there a function, list_func_index(), similar to the index() function that has a function, f(), as a parameter. the function, f() is run on every element, e, of the list until f(e) returns True. then list_func_index() returns the index of e.
...
Our business currently has an online store and recently we've been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the extra free items to their order after they checkout. Of course, it'd be nice to automate this entire process.
I've been mulling over a fe...
Python's paster serve app.ini is taking longer than I would like to be ready for the first request.
I know how to profile requests with middleware, but how do I profile the initialization time? I would like it to not fork a thread pool and quit as soon as it is ready to serve so the time after it's ready doesn't show up in the profile....
I'm using PyDev under Eclipse to write some Jython code. I've got numerous instances where I need to do something like this:
import com.work.project.component.client.Interface.ISubInterface as ISubInterface
The problem is that PyDev will always flag this as an error and say "Unresolved import: ISubInterface". The code works just fin...
I created a simple class in Python as follows,
from UserDict import UserDict
class Person(UserDict):
def __init__(self,personName=None):
UserDict.__init__(self)
self["name"]=personName
In another module I try to instantiate an object of class Person and print its doc and class attributes:
import Person
p = Person.Person("m...
When I update the code on my website I (naturally) restart my apache instance so that the changes will take effect.
Unfortunately the first page served by each apache instance is quite slow while it loads everything into RAM for the first time (5-7 sec for this particular site).
Subsequent requests only take 0.5 - 1.5 seconds so I woul...
I prefer using notepad ++ for developing,
How do I execute the files in Python through Notepad++?
...
Simple enough question:
I'm using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this default to the current time, but this is not ideal. It seems like a string literal constant (similar to a password) would also not be ideal/...
I'm quite new in Python world. I come from java and ABAP world, where their application server are able to handle stateful request.
Is it also possible in python using WSGI?
Or stateful and stateless are handled in other layer?
...
Hi,
I'm trying to read a list of items from a text file and format with square brackets and separators like this: ['item1','item2', .... 'last_item'] but I'm having trouble with the beginning and end item for which I always get: ...,'last_item','], so I do not want the last ,' to be there.
In python I've write:
out_list = "['"
for...
So I'm trying to parse strings similar to this:
"Sat, 11/01/09 8:00PM EST" in python, but I'm having trouble finding a solution that will handle the time zone abbreviation (I don't necessarily know what the timezone will be beforehand)
I'm trying to use the parse() function dateutil but it's not picking up on the abbreviated timezone. ...
What is the pythonic way of watching the tail end of a growing file for the occurrence of certain keywords?
In shell I might say:
tail -f "$file" | grep "$string" | while read hit; do
#stuff
done
...
I've been looking around for an existing python library in the style of textile to format text for users to enter.
If it was just me entering it, just textile would have been fine, but since the input is meant for a django app that will take user input and display it, while still maintaining some formatting.
I managed to find little lo...
I like the way ElementTree parses xml, in particular the Xpath feature. I've an output in xml from an application with nested tags.
I'd like to access this tags by name without specifying the namespace, is it possible?
For example:
root.findall("/molpro/job")
instead of:
root.findall("{http://www.molpro.net/schema/molpro2006}molpro/...
It is valid JavaScript to write something like this:
function example(x) {
"Here is a short doc what I do.";
// code of the function
}
The string actually does nothing. Is there any reason, why one shouldn't comment his/her functions in JavaScript in this way?
Two points I could think of during wiriting the question:
The st...
It's very easy to set a text editor to use spaces or tab characters with each press of the tab key. However, I'm working with a grip of Python code maintained by a large team of developers in my company, and some use spaces and some use tabs. I cannot simply make them all conform with each other, because 1) it would break git blame, 2) i...
Hello All,
I can't seem to build boost::python correctly on my Windows 7 64Bit machine. It's vanilla 32bit python 2.6.4 in the c:\Python26 directory.
Pastebin is here of the debug build output : http://pastebin.com/m7d70f13e
Cheers,
Al
...