Nov 292010
 

I’m running Ubuntu 10.10. Noticed various scripts failing. Discovered that if I tried to run python I would get this error:

$ python
Traceback (most recent call last):
  File "/usr/lib/python2.6/encodings/__init__.py", line 31, in 
    import codecs
ValueError: bad marshal data

The fix was simple. Do the following as root:

# rm /usr/llib/python2.6/codecs.pyc
# python

Running python as root after removing the compiled codecs file will cause the codecs.py file to be recompiled and a new codecs.pyc will be created. I did not get any more errors after that.

Jan 222010
 

Today was a rest day. Work, usual stuff. Mikie and I ate dinner at Dos Gallos afte work. I was good (no booze!)

I got in a really great book today that I ordered from Amazon: Matplotlib for Python Developers, by Sandro Tosi. Very well written with just the right amount of detail.

Dec 092009
 

MacPorts – Problem installing py26-pyusb

I was trying to install the pyusb package on my MacBook Pro. I have MacPorts installed and there is an available port. But when I tried to install py26-pyusb, I received the following error:

--->  Building py26-pyusb
Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_python_py26-pyusb/work/pyusb-0.4.2" && /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6 setup.py --no-user-cfg build " returned error 1
Command output: pyusb.c:1750: warning: implicit declaration of function 'usb_get_string'
pyusb.c:1750: error: 'Py_usb_DeviceHandle' has no member named 'deviceHandle'
pyusb.c: In function 'Py_usb_DeviceHandle_getDescriptor':
pyusb.c:1811: warning: implicit declaration of function 'usb_get_descriptor'
pyusb.c:1811: error: 'Py_usb_DeviceHandle' has no member named 'deviceHandle'
pyusb.c:1813: warning: implicit declaration of function 'usb_get_descriptor_by_endpoint'
pyusb.c:1813: error: 'Py_usb_DeviceHandle' has no member named 'deviceHandle'
pyusb.c: In function 'Py_usb_DeviceHandle_del':
pyusb.c:1988: error: 'Py_usb_DeviceHandle' has no member named 'deviceHandle'
pyusb.c:1991: error: 'Py_usb_DeviceHandle' has no member named 'interfaceClaimed'
pyusb.c:1992: error: 'Py_usb_DeviceHandle' has no member named 'deviceHandle'
pyusb.c:1993: error: 'Py_usb_DeviceHandle' has no member named 'interfaceClaimed'
pyusb.c:1996: warning: implicit declaration of function 'usb_close'
pyusb.c:1996: error: 'Py_usb_DeviceHandle' has no member named 'deviceHandle'
pyusb.c: In function 'new_DeviceHandle':
pyusb.c:2062: warning: implicit declaration of function 'usb_open'
pyusb.c:2062: warning: assignment makes pointer from integer without a cast
pyusb.c:2070: error: 'Py_usb_DeviceHandle' has no member named 'deviceHandle'
pyusb.c:2071: error: 'Py_usb_DeviceHandle' has no member named 'interfaceClaimed'
pyusb.c: In function 'busses':
pyusb.c:2090: warning: implicit declaration of function 'usb_find_busses'
pyusb.c:2095: warning: implicit declaration of function 'usb_find_devices'
pyusb.c:2100: warning: implicit declaration of function 'usb_get_busses'
pyusb.c:2100: warning: assignment makes pointer from integer without a cast
pyusb.c:2107: error: dereferencing pointer to incomplete type
pyusb.c:2111: error: dereferencing pointer to incomplete type
pyusb.c:2112: warning: passing argument 1 of 'new_Bus' from incompatible pointer type
pyusb.c: In function 'initusb':
pyusb.c:2172: warning: implicit declaration of function 'usb_init'
error: command '/usr/bin/gcc-4.2' failed with exit status 1

Error: Status 1 encountered during processing.

Tracked the problem down to a minor bug in the setup.py file that is used during the build process. On my Mac this was located in /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_python_py26-pyusb/work/pyusb-0.4.2. Here was the problem area:

elif -1 != platform.find("darwin"):
    extra_link_args = ['-framework',
                       'CoreFoundation',
                       '-framework',
                       'IOKit',
                       '-L/sw/lib',
                       '-L/usr/local/lib']
    extra_compile_args = ['-I/sw/include','-I/usr/local/lib']

This line:

extra_compile_args = ['-I/sw/include','-I/usr/local/lib']

should read

extra_compile_args = ['-I/opt/local/include','-I/usr/local/lib']

.

Triathlon Training, day 73

Today just had a field test at the track. I didn’t get to go do this until after work, after the farmer’s market, so it was dark and COLD at the Atascocita High School track. I’m not complaining, at least the gate wasn’t locked!

Just had to warm up for 1200 m and then run for 8 minutes and record everything. All went well except that I’ve just replaced my old Garmin FR 305 with a 310XT and I didn’t realize that one of the training options (autolap each mile) was enabled by default. So what was supposed to be lap 2 (the 8 minute run) is actually lap 2 and 3, with a pause in between them caused by me looking at the darn thing to figure out what was going on.

OK, keeping all that in mind, here is the data I was supposed to record:

Heart Rate (max): 160 b/m
Heart Rate (avg): 156 b/m
Duration: 06:53 (was supposed to be 8 minutes, see above)
Distance: 1.00 mi
Temperature: about 40 degrees F
Fatigue: Not sure what to put for this.  Felt OK.
Dec 082008
 

For anyone who is interested in Python programming, there is a monthly Houston Python Meet-up tomorrow evening. Here are the details:

Date/Time: Tuesday, December 9, 2008 at 7:00 PM Location: The Sauté Bistro, 2303 Richmond Avenue, Houston, TX 77098 (713-522-2106)

I will be giving a presentation about using Python with Amazon Web Services.

Here are various URLs from the presentation:

Main AWS Site.

API Tools

API Docs

CloudFront Docs

boto

Keynote presentation

Presentation as a PDF

Full Featured Python-S3 program

Twenty Rules for Amazon Cloud Security

Sep 102008
 

Just posted a complete implementation here.

This is the basic help output:

$ ./bulk_email -h
Usage: bulk_email [options] 'Subject line of the email message in quotes'
        
    Reads a list of email address from standard input.
    Sends emails to all of them.
    
    NOTE:   If you use this program to send SPAM you will be generating
            much negative Karma for yourself, so please DO NOT SPAM!!!
        
    These are the configuration values that are required in the config
    file:
    
    FROM='from-email-address'
    SMTP_ACCT='smtp-account'
    SMTP_PASS='smtp-password'    
    
    Here are some optional configuration parameters.  They may be overridden
    in the config file.  Note that by default we are using gmail!
    
    SMTP_HOST='smtp-host'   # default = smtp.gmail.com
    SMTP_PORT=smtp-port     # default = 587
    SMTP_USE_TLS=True|False # default = True

Options:
  --version         show program's version number and exit
  -h, --help        show this help message and exit
  -x, --extra-help  If specified, print out EXTRA help and exit
  -v, --verbose     If specified, print out information while processing.
  --config=CONFIG   The file that contains configuration info for the program.
                    By default, the program will look for a configuration file
                    in /home/gordy/.bulk_email.rc
  --html=HTML       The file that contains the HTML-formatted message
                    (required)
  --plain=PLAIN     The file that contains the plain-text message (optional,
                    but recommended)
  -e, --embed       If specified, scan the html copy for any <img /> tags.
                    Fetch the referenced image.  Encode and embed it and
                    replace the src attribute of the <img /> with a cid:imagex
                    reference.

You can get extended output (which I won’t post here due to length) by using the -x option like bulk_email -x.

For the love of all that is holy and good, please DON’T SPAM!!!