python

Can Ironpython be used to run multiple Python Virtual Machine Instances in parallel?

Inspired from the game GunTactyx, where you write programs controlling fighting robots. Guntactyx used the Small language, that later is called Pawn. I am looking into using Python as the scripting language. My concerns are: Interfacing to C# The scripts should interface into C# through simple functions, doing stuff like scanning fo...

Python webservice client

Can anyone make a webservice client in python from the following JAX-WS API? https://109.231.73.12:8090/API?wsdl As I'm running this of a virtual server it's self signed. Both the username and password are 'querty123' We can get it to work in php just fine not python. So a working example explaining how you managed to do it would be ...

set process name in mod_wsgi

I'm running a site by apache2.x with mod_wsgi 2.5, and python2.5. It is configured to run in multi-processes and each process only contains one thread. When I read this post, I try to set the process name to PATH_INFO, but it doesn't work. My code is like: import ctypes libc = ctypes.CDLL('/lib/libc.so.6') def application (environ, st...

Is it possible to repeat an iteration of a loop?

Hello all! I have defined a for loop as follows which scans through a file made up of two columns, when it finds the keyword DEFINE_MENU the second column on this line refers to the title for a screen. The next instance of the keyword will define a title for a seperate screen and so on to the nth screen. At the moment the code is capabl...

how to delete an attribute when a flush or commit has finished in a MapperExtension [sqlalchemy]

I was trying to get the last value "before_insert" a new item but i didn't find out, so i change of strategy and i saved the last value of this method, but the problem is that when i do other commits my old MapperExtension attribute (self.last_value) get the last value and i dislike it, even when I close and open a new Session (discovere...

Subclassing int in Python

I'm interested in subclassing the built-in int type in Python (I'm using v. 2.5), but having some trouble getting the initialization working. Here's some example code, which should be fairly obvious. class TestClass(int): def __init__(self): int.__init__(self, 5) However, when I try to use this I get: >>> a = TestClass()...

Bluetooth programming in python

Are there any nice python libraries for Bluetooth programming? I tried pybluez, but Eclipse doesn't even recognize the module bluetooth. Can any one suggest some nice tutorials for this stuff? Thanx in advance.. ...

python introspection - how to detect the object i am in

Suppose I have a free function which has been called from a class method. Is there a way for me to introspect the call stack in the free function and determine what object called me? def foo(arg1) : s = ? #Introspect call stack and determine what object called me # Do something with s Thanks! ...

ksh-style left and right string stripping up to matched expression?

How can one strip the left parts and right parts off strings up to a matching expression as in ksh? For instance: ${name##*/} ${name%/*} (see http://www.well.ox.ac.uk/~johnb/comp/unix/ksh.html for ksh examples). I can't seem to figure out a simple way of doing this using re module or string module but I must be missing something. ...

Does anyone have a "dark" pycharm schema file?

I'm trying out pycharm for django development and I can't stand the white background. Can someone provide a place to download a schema file? Switching all the colors manually is tedious and time consuming. Is it maybe possible to use komodo schemas? ...

Urllib quoting problem: dealing with â characters from a latin-1 database

I need to get an â character into a format that can be passed to a URL. I'm obtaining some names as a json list, and then passing them elsewhere. result = json.load(urllib2.urlopen(LIST_URL), encoding='latin-1') for item in result: name = item["name"] print name print urllib2.quote(name.lower()) This produces a urllib erro...

Python URLLib / URLLib2 POST

I'm trying to create a super-simplistic Virtual In / Out Board using wx/Python. I've got the following code in place for one of my requests to the server where I'll be storing the data: data = urllib.urlencode({'q': 'Status'}) u = urllib2.urlopen('http://myserver/inout-tracker', data) for line in u.readlines(): print line Nothing...

Making QProgressDialog update, also value does not change

Hey, I have a progress which I "mintor" with a QProgessDialog in PyQt4. Basicly, I have a loop like this: while progressThread.isRunning(): self.progressDialog.setRange(0, self.progressTotal_) self.progressDialog.setValue(self.progress_) del self.progressDialog The progressThread upades the variables self.progessTotal_ and se...

How can I open an Excel file in Python?

How do I open a file that is an excel file for reading in python? I've opened text files ie sometextfile.txt with the reading command. how do i do that for an excel file? ...

Setting separate choices for argument with two values using argparse in Python

I currently have the following code: import argparse parser = argparse.ArgumentParser(description='Adds a new modem to Iridium account') parser.add_argument('imei', metavar='I', nargs=1, help='the modems IMEI') parser.add_argument('-t1', '--type1', metavar='t1', nargs=1, choices=('email', 'directip', 'sbddevice'), default='directip', h...

the best search engine written with python

i want to build an information support system which is an web app. and we gonna use Django as the frame,but i don't know which search engine to use ? can you give me some suggestions on the search engine which we can use in our project,it must be written with python. thanks ...

How to manage python threads results?

I am using this code: def startThreads(arrayofkeywords): global i i = 0 while len(arrayofkeywords): try: if i<maxThreads: keyword = arrayofkeywords.pop(0) i = i+1 thread = doStuffWith(keyword) thread.start() except KeyboardInterrupt: ...

IOError: [Errno 22] Invalid Argument with clock() being passed in.

I have not had much luck hunting for finding a good explanation of what invalid argument errors are and what would cause them. My current sample I am working with is import sys mylog="mylog.log" sys.stdout = open(mylog,'w') #lots of code #. #. #. #End of lots of code from time import clock print "blablabla",clock() I receive an IOE...

Python RESTful client with CAS authentication

I'm trying to build a python library for interacting with our RESTful API, but it uses CAS for client auth, and I haven't been able to find any good existing libraries for it. So far I've found the following links, but I'm not sure if they're intended to be used in clients or by a website that uses CAS itself. Does anyone have any advice...

best python lib to clean the tag (not safe), and keep the tag that i think safe.

ex: i want to clean the "script" tag , but i want to keep the 'a' tag , so what lib you using to do this . and i use jquery cleditor for WYSIWYG HTML editor , can it do this for me automatically ? thanks ...