python

What makes pylint think my class is abstract?

As I understand it, Python (2.5.2) does not have real support for abstract classes. Why is pylint complaining about this class being an "Abstract class not reference?" Will it do this for any class that has NotImplementedError thrown? I have each class in its own file so if this is the case I guess I have no choice but to suppress this ...

nesting python list comprehensions to construct a list of lists

I'm a python newb and am having trouble groking nested list comprehensions. I'm trying to write some code to read in a file and construct a list for each character for each line. so if the file contains xxxcd cdcdjkhjasld asdasdxasda The resulting list would be: [ ['x','x','x','c','d'] ['c','d','c','d','j','k','h','j','a','s','l',...

What's the best way to set up symbolic links to current installs, e.g python -> python2.6

What's the best way to set up symbolic links to current installs, e.g python -> python2.6? I've just installed python2.6 through Macports at /opt/local/bin/python2.6, I'd now like to set up a symbolic link called python here /usr/local/bin/. I then want to be able to add this line at the beginning of my pythons scripts so it knows wher...

Spam Filtering Forms Without Akismet

I'm curious if anyone out there knows of something perhaps like Akismet, but where content doesn't have to go off to a 3rd party server. In a situation with critically sensitive data (patient records for instance) I wouldn't necessarily want that information sent off to another server I don't have control over. I really like Akismet, it ...

iPhone client with a python socket

Hi all, i am creating a python server socket that sends data to the client reguarding files status... what i have is a list containing dictionaries: [{'Status': '[2,5%]', 'File': 'SlackwareDVD.iso'}, {'Status': '[21,8%]', 'File': 'Ubuntu_x86.iso'}] the socket, when asked, sends this data, obviously it is sent as a string type.. i was...

Does Python 3 have LDAP module?

Hi, I am porting some Java code to Python and we would like to use Python 3 but I can't find LDAP module for Python 3 in Windows. This is forcing us to use 2.6 version and it is bothersome as rest of the code is already in 3.0 format. ...

python skipping inner loop in nested for loop

I am using some python to do some variable name generation. For some reason I am only getting part of what I need. import sys import csv params = csv.reader(open('params.csv'), delimiter=',', skipinitialspace=True) flags_r = [] flags_w = [] numbers_r = [] numbers_w = [] station = ['AC1','DC1','DC1'] drive = ['','Fld','Arm'] for i in ...

registering python com server

Hi all, I have a problem when registering a Python com server, I got a message box that says : Invalid command line argument. This programs provides LocalServer com support for Python COM objects. It is typically run automatically by COM, passing passing as arguments The ProgID or CLSID of the Python server(s) to be ho...

custom prompt in python

I have a script which when first run creates a new thread which logs certain events. After the thread has been created, I ask for some input on user with the following code: user_input = raw_input('>> ') So when the script it run the user receives the '>>' prompt, but when the logger from the created thread starts logging it starts to...

What are the best practices of the App Engine datastore?

I have developed some applications in Google App Engine but sometimes I have problems to "translate" my rational database mind to datastore objects (most of the time because I don't want to use the Key as ID of the data.) So, if I populate a combo (or any other control) how can I distinguish the uniqueness of the data? Now I'm reading ...

Having trouble understanding CherryPy

I read through the tutorial on the cherrypy website, and I'm still having some trouble understanding how it can be implemented in a modular, scalable way. Could someone show me an example of how to have cherrypy receive a simple http post to its root, process the variable in some way, and respond dynamically using that data in the resp...

writing pexpect like program in c++ on Linux

Is there any way of writing pexpect like small program which can launch a process and pass the password to that process? I don't want to install and use pexpect python library but want to know the logic behind it so that using linux system apis I can build something similar. ...

Regex for getting content between $ chars from a text

The problem: I need to extract strings that are between $ characters from a block of text, but i'm a total n00b when it comes to regular expressions. For instance from this text: Li Europan lingues $es membres$ del sam familie. Lor $separat existentie es un$ myth. i would like to get an array consisting of: {'es membres', 'separat exis...

Are Python docstrings and comments stored in memory when module is loaded?

Are Python docstrings and comments stored in memory when module is loaded? I've wondered if this is true, because I usually document my code well; may this affect memory usage? Usually every Python object has a __doc__ method. Are those docstrings read from the file, or processed otherwise? I've done searches here in the forums, G...

who can tell me what can call the built-in functions in next code .

i know some of this,ex. __mod__ will be call / __eq__will be call == > and < but i don't know all. def __nonzero__(self): # an image is "true" if it contains at least one non-zero pixel return self.im.getbbox() is not None def __abs__(self): return self.apply("abs", self) def __pos__(self): ...

Please discuss what are and why use portlets

Why would I want to use java portlets above tomcat and gwt? Would portlets make it less- or un- necessary for me to use jsp and jsf? Has Jboss been part of the portlet evolution culture? Does Jboss satisfy the portlet jsrs? What portlet implementation/brand would run on gae java and gae python? Are portlet specs due to peer pressure fro...

i can't found '_weakref.py',where is '_weakref.py'.

from _weakref import ( getweakrefcount, getweakrefs, ref, proxy, CallableProxyType, ProxyType, ReferenceType) thanks ...

Python Encapsulate a function to Print to a variable

If I have a function that contains a lot of print statements: ie. def funA(): print "Hi" print "There" print "Friend" print "!" What I want to do is something like this def main(): ##funA() does not print to screen here a = getPrint(funA()) ##where getPrint is some made up function/object print a ##prints what funA wou...

Why Unexpected Indent?

Why does this happen? def LoadPackageList(): try: #Attempts to load package list... Adds each neccessary attribute into array print("Loading Package List... please wait") packages = [] packagelisturl = os.getcwd() + "packages.list" dom = minidom.parse(urllib.urlopen(packagelisturl)) tr...

why my code make dead-loop,it is about 'iter(c,a)'

def c(): yield 222 yield 333 a=[1,2,3,4] b=iter(c,333) print a,b for i in b: print i how can i get it. ...