python

Text Editor For Linux (Besides Vi)?

Let me preface this question by saying I use TextMate on Mac OSX for my text needs and I am in love with it. Anything comparable on the Linux platform? I'll mostly use it for coding python/ruby. Doing a google search yielded outdated answers. Edit: Since there has been some concern about the 'merit' of this question. I am about to ...

An executable Python app

Python works on multiple platforms and can be used for desktop and web applications, thus I conclude that there is some way to compile it into an executable for Mac, Windows and Linux. The problem being I have no idea where to start or how to write a GUI with it, can anybody shed some light on this and point me in the right direction pl...

Calling a Function From a String With the Function's Name in Python

What is the best way to go about calling a function given a string with the function's name in a python program. For example, let's say that I have a module foo, and I have a string whose contents are "bar". What is the best way to go about calling foo.bar()? I need to get the return value of the function, which is why I don't just us...

Best ways to teach a beginner to program?

Original Question I am currently engaged in teaching my brother to program. He is a total beginner, but very smart. (And he actually wants to learn). I've noticed that some of our sessions have gotten bogged down in minor details, and I don't feel I've been very organized. (But the answers to this post have helped a lot.) What can I ...

Programmatically talking to a Serial Port in OS X or Linux

I have a Prolite LED sign that I like to set up to show scrolling search queries from a apache logs and other fun statistics. The problem is, my G5 does not have a serial port, so I have to use a usb to serial dongle. It shows up as /dev/cu.usbserial and /dev/tty.usbserial . When i do this everything seems to be hunky-dory: stty -f /d...

How to sell Python to a client/boss/person with lots of cash

When asked to create system XYZ and you ask to do it in Python over PHP or Ruby, what are the main features you can mention when they require you to explain it?...

Learning Ruby on Rails any good for Grails?

My company is in the process of starting down the Grails path. The reason for that is that the current developers are heavy on Java but felt the need for a MVC-style language for some future web development projects. Personally, I'm coming from the design/usability world, but as I take more "front-end" responsibilities I'm starting to fe...

How do you set up Python scripts to work in Apache 2.0?

I tried to follow a couple of googled up tutorials on setting up mod_python, but failed every time. Do you have a good, step-by step, rock-solid howto? My dev box is OS X, production - Centos....

Anyone have experience creating a shared library in MATLAB?

A researcher has created a small simulation in MATLAB, and we want to make it accessible to others. My plan is to take the simulation, clean up a few things, and turn it into a set of functions. Then, I plan to compile it into a C library and use SWIG to create a Python wrapper. At that point, I should be able to call the simulation from...

Cross Platform, Language Agnostic GUI Markup Language?

I learned Swing back in the day but now I've moved to Python and want to make some apps with GUIs. I haven't had the time to learn a new GUI API so I've been using Jython, but I would prefer to use CPython. It would be great if I can have one simple markup that allows me to switch GUI libraries. It would be even better if I can use the...

Convert Bytes to Floating Point Numbers in Python

I have a binary file that I have to parse and I'm using Python. Is there a way to take 4 bytes and convert it to a single precision floating point number?...

Python, Unicode, and the Windows console

When I try to print a Unicode string in a windows console, I get a "UnicodeEncodeError: 'charmap' codec can't encode character ...." error. I assume this is because the Windows console does not accept Unicode-only characters. What's the best way around this? Is there any way I can make Python automatically print a "?" instead of faili...

Get size of a file before downloading in Python

I'm downloading an entire directory from a web server. It works OK, but I can't figure how to get the file size before download to compare if it was updated on the server or not. Can this be done as if I was downloading the file from a FTP server? import urllibimport reurl = "http://www.someurl.com"# Download the page locallyf = urllib....

Best way to abstract season/show/episode data

Basically, I've written an API to www.thetvdb.com in Python. The current code can be found here. It grabs data from the API as requested, and has to store the data somehow, and make it available by doing: print tvdbinstance[1][23]['episodename'] # get the name of episode 23 of season 1 What is the "best" way to abstract this data with...

Recommendation for straight-forward python frameworks

Although I have quite a few years of experience of building web applications in Java, I've not really done much web development in the more lightweight 'LAMP' style. I've recently picked up python and am quite liking what I see so far, but there isn't an 'obvious' choice for which web framework to use, as it seems there are a number of ...

Pylons error - 'MySQL server has gone away'

[I hope this isn't too obscure I'll ask the newsgroup if nobody knows here] I'm using Pylons (a python framework) to serve a simple web application, but it seems to die from time to time, with this in the error log: (2006, 'MySQL server has gone away') I did a bit of checking, and saw that this was because the connections to MySQL were...

how to use xpath in python

Is there a full implementation? How is the library used, where is its website? ...

Should I move from C++ to Python? ... Or another language?

In the company I work for, we do a lot of file-based transaction processing. The processing centers around the conversion of files between numerous formats to suit numerous systems in numerous companies. The processing almost always involves an XML stage and can include a lot of text parsing, database lookups, data conversion and data v...

Accessing mp3 Meta-Data with Python

What is the best way to retrieve mp3 metadata in python? I've seen a couple frameworks out there, but I'm unsure as to which would be the best to use.... Any ideas? ...

How do I treat an integer as an array of bytes in Python?

I'm trying to decode the result of the Python os.wait() function. This returns, according to the Python docs: a tuple containing its pid and exit status indication: a 16-bit number, whose low byte is the signal number that killed the process, and whose high byte is the exit status (if the signal number is zero); the high bit of the l...