python

mysqldb on python 2.6

I am currently using python 2.6 and I would like to use the win32 mysqldb module. Unfortunately it seems it needs the 2.5 version of Python. Is there any way to get rid of this mismatch in the version numbers and install mysqldb with python 2.6? ...

Why does setuptools sometimes delete and then re-install the exact same egg?

I'm trying to install an egg on a computer where an identical egg already exists. Why does it remove the egg and then re-install it? I'm calling easy_install from a script with the options: ['-v', '-m', '-f', 'R:/OPTIONS/Stephen/python_eggs', 'mypkg==1.0_r2009_03_12'] While running the easy_install command this was observed: Searchin...

URL tree walker in Python?

For URLs that show file trees, such as Pypi packages, is there a small solid module to walk the URL tree and list it like ls -lR? I gather (correct me) that there's no standard encoding of file attributes, link types, size, date ... in html <A attributes so building a solid URLtree module on shifting sands is tough. But surely this wheel...

Writing binary data to a socket (or file) with Python

Let's say I have a socket connection, and the 3rd party listener on the other side expects to see data flowing in a very structured manner. For example, it looks for an unsigned byte that denotes a type of message being sent, followed by an unsigned integer that denotes the length of message, then another unsigned byte which is really a ...

Python book to buy?

Is it worth to buy Python In A Nutshell second edition or should I wait for next version Suggestion for any other book is welcome I am looking for a book like The c++ progrogramming language by stroustrup but for python ...

Is there any use for Flex + Python/Ruby without a web framework (Django/Rails)?

I often hear about Flex being combined with web frameworks on the backend. The idea being that Flex serves as the presentation framework while the web framework (Django/Rails) does the database lookups and sends the data to Flex to present in the form of XML. However, is there ever a situation where Flex and Python/Ruby would be combine...

Embed Python script

Hi, I have some Python Scripts which I would like to use from my VB.NET class library however instead of increasing the amount of files that I distribute is it possible to embed the script into my project/dll in Visual Studio and then run the script from the dll during my program runtime? Thanks for any help. Rob ...

Python: Why can't I modify the current scope within a function using locals()?

Why does creating/modifying a member of locals() not work within a function? Python 2.5 (release25-maint, Jul 20 2008, 20:47:25) [GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> # Here's an example of what I expect to be possible in a function: >>> ...

Python, Convert 9 tuple UTC date to MySQL datetime format

I am parsing RSS feeds with the format as specified here: http://www.feedparser.org/docs/date-parsing.html date tuple (2009, 3, 23, 13, 6, 34, 0, 82, 0) I am a bit stumped at how to get this into the MySQL datetime format (Y-m-d H:M:S)? ...

Best resources for starting Jython

I just got my first Jython (and Python) project, and I was wondering what documentation, IDEs, etc. are best suited to a Java buff like me. I know there are a lot of questions about starting out with Python, so I'm asking for things that might be specific to Jython. Where should I start? If it helps, I'm running Linux and Solaris only....

pygame is screwing up ctypes

import mymodule, ctypes #import pygame foo = ctypes.cdll.MyDll.foo print 'success' if i uncomment the import pygame this fails with WindowsError: [Errno 182] The operating system cannot load %1. the stack frame is in ctypes python code, trying to load MyDll. win32 error code 182 is ERROR_INVALID_ORDINAL. if the pygame import is no...

Redirecting function definitions in python

Pointing the class method at the instance method is clearly causing problems: class A(dict): def __getitem__(self, name): return dict.__getitem__(self, name) class B(object): def __init__(self): self.a = A() B.__getitem__ = self.a.__getitem__ b1 = B() b1.a['a'] = 5 b2 = B() b2.a['b'] = 10 c = b1['a'] d = ...

How to get the root node of an xml file in Python?

Basically I am using: from xml.etree import ElementTree as ET path = 'C:\cool.xml' et = ET.parse ( path ) But I am not sure how to get the root from et? ...

Is there a method in Python to list the properties and methods of a particular object?

Is there a method in Python to list the properties and methods of a particular object? Something like: ShowProperties ( myObject ) -> .count -> .size ShowMethods ( myObject ) -> len -> parse ...

How to set up Python for .NET with Python 2.6.1?

The "final" release of Python for .NET (link) isn't pre-compiled for Python 2.6. I don't have a problem changing the compilation symbol to PYTHON26 as specified in the docs, the solution rebuilds just fine, but when attempting to import the CLR, I get an error indicating that python26.dll is missing. Anyone know how to build this file? I...

Best SOAP library for Python

I need to connect to a SOAP API in Python. A quick google led me here. Awesome, I thought, that looks perfect. However SOAPpy doesn't work with any moderately recent version of Python, and even if I could fix that, it depends on PyXML, which seems to have dropped off the net. So my question: what is the best library to use to connect to...

Python game programming: is my IO object a legitimate candidate for being a global variable?

Hello Stackoverflow, I'm programming a game in Python, where all IO activities are done by an IO object (in the hope that it will be easy to swap that object out for another which implements a different user interface). Nearly all the other objects in the game need to access the IO system at some point (e.g. printing a message, updating...

How to get upper paths from a single path?

How to get upper paths from a single path? So say you have a path like: 'C:\a\b\c\d\' How do I get to 'C:\a\b' or 'C:\a\b\c' Is there a pythonic way to do this? ...

Including Python standard libraries in your distribution

For a project I'm working on I need to include some Python modules that come standard with the Python SDK because the platform I am targetting (to be precise, PyS60) does not include these modules. Are there any licensing issues I need to address? Do I need to include the PSF license in my project? My project is licensed under Apache 2....

Is there a better Python bundle for textmate than the one in the bundle repository?

At this time Textmate's official Python bundle is really bare bones, especially in comparison to the Ruby bundle. Does anyone know of a Python bundle that is more complete? EDIT: I am fully aware that there are editors and environments that are better suited to Python development, but I am really just interested to see if there is a th...