Articles tagged with Python

Run/Debug as root in PyCharm

By Eric — 4 minute read

I'm working on a Python project that needs to run as root in order to work properly. Previously I've just run the whole PyCharm IDE as root, but this has some down-sides, and I think I have a better approach now.

The biggest hassle with running the IDE as root …

Read more...

Your right margin is telling you something

By Eric — 1 minute read

The recommendation to keep lines widths less than 80 characters is a surprising part of the Python style guide (PEP 8). Really, 79 characters? Is it still the 1980's in Python-land? Maybe it's time to upgrade that monochrome CRT and get some screen real-estate.

Acting a bit on faith, and …

Read more...

SQLAlchemy with Python 64-bit on Windows

By Eric — 2 minute read

While hooking up SQLAlchemy for a web project, I kept running into attribute errors for 'session_registry'. I figured I was doing something wrong, so I thought I'd just walk through the tutorial as a sanity check.

I was, apparently, insane.

>>> u = session.query(User).filter_by(name='ed').first()
Traceback (most …

Read more...

Python Packaging (2013 Edition)

By Eric

About a year ago, I set out to get a solid working understanding of Python packaging, resulting in a lengthy blog post of what I learned. There have been some significant course changes over that year such that my original post is wrong in several regards.

Here's a summary of …

Read more...

Getting pip into your Python 3 venv

By Eric — 1 minute read

Python 3.3 includes a built-in equivalent to the popular virtualenv tool for creating isolated Python environments. One difference with the built-in venv is that it doesn't automatically install pip as virtualenv does. While I can understand the decision (given Python's volatile packaging situation), it isn't very convenient.

Here's a …

Read more...

Python Packaging Demystified

By Eric — 6 minute read

IMPORTANT: Some of the information in this post is now obsolete. Please see here.

Randomly take a couple of words from the following list, put them together, and there's a decent chance you'll come up with something real involving Python packaging.

  • setup
  • install
  • dist
  • distribute
  • tools
  • utils
  • easy
  • py

The …

Read more...

Clean HTML from Microsoft Word: Rube Goldberg Method

By Eric — 3 minute read

Wouldn't it be nice to be able to save nice clean HTML from Microsoft Word? Here's a way that is only slightly convoluted.

If you use the "Web Page, Filtered" option from Word, you get buried in piles of CSS cruft, but as noted here, you can use the Publish …

Read more...

Updating an Amazon Linux AMI to Python 2.7

By Eric — 2 minute read

I've been doing some work with Linux lately, a new thing for me, and feel a bit like I've been thrown into the deep end and told to swim. Today I updated Python to version 2.7 on an EC2 instance.

Amazon Linux (Basic 64-bit Amazon Linux AMI 2011.09 …

Read more...