python

Is there a recommended package for machine learning in Python?

Is there a recommended package for machine learning in Python? I have previous experience in implementing a variety of machine learning and statistical algorithms in C++ and MATLAB, but having done some work in Python I'm curious about the available packages for Python. ...

Web Application Frameworks: C++ vs Python

Hello, I am familiar with both Python and C++ as a programmer. I was thinking of writing my own simple web application and I wanted to know which language would be more appropriate for server-side web development. Some things I'm looking for: It has to be intuitive. I recognize that Wt exists and it follows the model of Qt. The one t...

How do I split different applications across multiple tcp ports on one site?

I have a series of applications which use one model and are all under one site. Essentially a mix of the main website, and public and private api's. Is there a way to make different DJango apps use a different tcp port? I have not been able to find anything in the documentation about it. ...

How can I capture the error output from the ipython shell?

I'm writing an ipython macro that processes the output of a program. The thing is, the program can sometimes write to stderr , so if I do something like this : out = !my_program the out variable will not contain the output. I think it will contain the exit code ( correct me if I'm wrong ). How can I capture both stdout and stderr st...

python: Overhead to using classes instead of dictionaries?

First, I'd like to point out that I know OOP concepts and understand the differences between dictionaries and classes. My question is about what makes sense design wise in this case: I am designing a webapp in python and I have to represent something like a book object. Books have chapters and chapters have titles and content. For simpl...

Overhead of Mono Tasklet/Co-Routines

Hi, What are the main performance overheads (gc/stack copying...) of the new Mono Continuations/Tasklet framework? How does this overhead (coroutine performance / raw performance) compare to other frameworks such as Lua Coroutine and stackless python? In Mono 2.6 continuation/coroutines support will be added. I built a svn version and...

Python urllib2 problem?

I installed Python 2.6.2 earlier on a Windows XP machine and run the following code: import urllib2<br> import urllib<br><br> page = urllib2.Request('http://www.python.org/fish.html')&lt;br&gt; urllib2.urlopen( page )<br><br> I get the following error. Traceback (most recent call last):<br> File "C:\Python26\test3.py", line 6, in <...

converting django ForeignKey to a usable directory name

Hello, I'm working on a django app where the user will be able to upload documents of various kinds. The relevant part of my models.py is this: class Materials(models.Model): id = models.AutoField(primary_key=True) id_presentations = models.ForeignKey(Presentations, db_column='id_Presentations', related_name = "materials_id_pre...

python regex help: unknown information to skip

I'm having trouble with the needed regular expression... I'm sure I need to probably be using some combination of 'lookaround' or conditional expressions, but I'm at a loss. I have a data string like: pattern1 pattern2 pattern3 unwanted-groups pattern4 random number of tokens pattern5 optional1 optional2 more unknown unwanted junk sepa...

OpenGL Picking with Pyglet

I'm trying to implement picking using Pyglet's OpenGL wrapper, but I'm having trouble converting a C tutorial to Python. Specifically the part below. #define BUFSIZE 512 GLuint selectBuf[BUFSIZE] void startPicking(int cursorX, int cursorY) { GLint viewport[4]; glSelectBuffer(BUFSIZE,selectBuf); glRenderMode(GL_SELECT); ...

Django Admin Inline Change List

I can edit a parent child relationship using the TablularInline and StackedInline classes, however I would prefer to list the child relationships as a change list as there is a lot of information and the forms are too big. Is there an inline change list available in DJango admin or a way or creating one? ...

Python / ADOX: 'The specified module could not be found.' (win32 extensions)

I'm running pywin32 for python 2.5. I'm following the instructions for python ADO given at http://www.ecp.cc/pyado.html. Creating an ADODB.Recordset object works fine. But when I try to create an ADOX.Catalog object I get an error: >>> cat=win32com.client.Dispatch(r'ADOX.Catalog') Traceback (most recent call last): File "<interact...

Python Win32 - equivalent function to DriveInfo.IsReady

I'm trying to find an equivalent Python function to the Windows function DriveInfo.IsReady. I've spent a while searching through the functions provided by win32api and win32file but I can't find anything (though perhaps that's because I didn't manage to find much useful documentation online, so was simply searching through the listing o...

UnicodeDecodeError when using socket.gethostname() result

Some of my users report that the following code may raise a UnicodeDecodeError when the hostname contains non-ascii characters (however I haven't been able to replicate this on my Windows Vista machine): self.path = path self.lock_file = os.path.abspath(path) + ".lock" self.hostname = socket.gethostname() self.pid = os.g...

Running a python script from the command line in Windows

I'm trying to run SnakeFood, to analyze a python project. I'm on a Windows machine and so far I've been able to figure out how to: install Tortoise for Mercurial to download the SnakeFood code from the site set the windows Path to accept python from the command prompt so I could do python setup.py install and got snakefood to go into m...

list of duplicate dictionaries copy single entry to another list

Hello, newbie question again. Let's say i have a list of nested dictionaries. a = [{"value1": 1234, "value2": 23423423421, "value3": norway, "value4": charlie}, {"value1": 1398, "value2": 23423412221, "value3": england, "value4": alpha}, {"value1": 1234, "value2": 23234231221, "value3": norway, "value4": charlie}, {"val...

scrollbar for statictext in wxpython?

Hi... is possible to add a scrollbar to a statictext in wxpython? the thing is that i'm creating this statictext: self.staticText1 = wx.StaticText(id=wxID_FRAME1STATICTEXT1,label=u'some text here',name='staticText1', parent=self.panel1, pos=wx.Point(16, 96), size=wx.Size(408, 216),style=wx.ST_NO_AUTORESIZE | wx.THICK_FRAME | w...

IsPointInsideSegment(pt, line) in Python

Is there a nice way to determine if a point lies within a 3D line segment? I know there are algorithms that determine the distance between a point and line segment, but I'm wondering if there's something more compact or efficient. ...

Can I store objects in Python class members?

I'm writing a game in Python with the Pygame2 multimedia library, but I'm more accustomed to developing games with ActionScript 3. In AS3, I don't think it was possible to store an object in a static variable, because static variables were initialized before objects could be instantiated. However, in Python, I'm not sure if this holds ...

Can't get Beaker sessions to work (KeyError)

I'm a newb to the Python world and am having the dangest time with getting sessions to work in my web frameworks. I've tried getting Beaker sessions to work with the webpy framework and the Juno framework. And in both frameworks I always get a KeyError when I try to start the session. Here is the error message in webpy (its pretty mu...