Re: Using struct to read binary files

2009-11-27 Thread mercado
Thanks Tim and Gabriel! That was exactly what I needed -- http://mail.python.org/mailman/listinfo/python-list

Using struct to read binary files

2009-11-26 Thread mercado
Hello, I am writing a Python program to read the Master Boot Record (MBR), and I'm having trouble because I have no previous experience reading binary files. First off, I've written a binary file containing the MBR to disk using the following command: sudo dd if=/dev/sda of=/tmp/mbrcontent bs=1 c

Passing a variable number of arguments to a function

2009-02-12 Thread mercado
I have the following piece of code that is bugging me: #--- def someFunc(arg1, arg2=True, arg3=0): print arg1, arg2, arg3 someTuple = ( ("this is a string",), ("this is another string", False), ("this is a

Testing against different versions of Python

2008-12-12 Thread mercado
What is the best way to go about testing against different versions of Python? For example, I have 2.5.2 installed on my machine (Ubuntu Hardy 8.04), and I want to test a script against 2.5.2 and 2.5.1 (and possibly other versions as well). Thanks in advance. -- http://mail.python.org/mailman/lis

Fwd: [wxpython-users] Setting up global keybindings without corresponding menu items

2008-11-24 Thread mercado mercado
Forwarded conversation Subject: Setting up global keybindings without corresponding menu items From: *mercado mercado* <[EMAIL PROTECTED]> Date: Fri, Aug 1, 2008 at 4:15 PM To: [EMAIL PROTECTED] I'm trying to set up a global keyboard shortcut for my applicati

Retrieving the name of the class calling an instance method

2008-09-05 Thread mercado mercado
In Python, is it possible for an instance method to know the name of the class which is calling it? For example, in the sample below, I would like for the someMethod method to print the name of the class calling it ("bar" in the first case, "again" in the second). -

Importing different versions of a module

2008-07-23 Thread mercado mercado
Thank you Fredrik. This is exactly what I was looking for. > cannot you just insert the appropriate directory in sys.path the first > thing you do in the scripts? e.g. > > import os, sys > > lib = "lib_dev" # change this for prod/rss.py > > sys.path.insert(0, > os.path.j

Re: Importing different versions of a module

2008-07-22 Thread mercado mercado
It seems that you can specify the name of the module to be imported at runtime using the following syntax: X = __import__('X') (from http://effbot.org/zone/import-confusion.htm) Of course, I would rather specify the path to the module at runtime, not the module name itself, but at least this is

Re: Importing different versions of a module

2008-07-18 Thread mercado mercado
Thanks norseman for the reply. You're right that I didn't like it though. :-) Also note that my original question has to do with importing modules from different locations. If all I had to do was use different paths within the script (e.g. for sending to os.path.join or whatever), then I could

Importing different versions of a module

2008-07-17 Thread mercado mercado
I have two versions of a script on my machine. One version is for new development and the other version is a production version. This script imports a module from a different directory, and this module again has two versions (a development version and a production version). What I want is for the