PopPage Demo

PopPage is a small side project I started a few years but haven't really updated much until recently. PopPage was originally a simple static HTML generator; at the time I just needed a utility to apply content to Jinja2 templates. However, recent updates have effectively made it a cookiecutter clone with a few neat features. Unlike cookiecutter, PopPage information is supplied from YAML files rather than JSON files. As of PopPage 0.3.1, there …

more ...

DevLog - Qprompt

Qprompt is a simple CLI library for Python that I have slowly working on for about two years now. It provides basic typed prompts and menus in a CLI environment along with some additional convenience functions. Recently, I added a feature that allows prompt inputs to be automatically entered via stdin; I have found this feature to be enormously helpful. Let's look at an example use case.

Use Case - QuickWin Build Menu

QuickWin is another …

more ...

Weekly Picks - Python Gotcha Awareness

While mostly straightforward and simple, Python still has its share of gotchas and gremlins, one such explored in this post. Familiarizing yourself with common gotchas can help avoid issues and aid debugging.


more ...

Automate Stdin For Python Tests (Updated)

Date Tags python

NOTE: This is an update to a previous post.

The following can be used to programmatically set stdin for testing under Python 3.x:

import sys
from io import StringIO
sys.stdin = StringIO()
setinput = lambda x: [

Here is a quick example of using setinput() in Python 3.x:

name = input("Enter name:")
more ...

Vim/Python Compatibility Issue

Date Tags python / vim

Found out the hard way that certain versions of Vim are not compatible with certain versions of Python. I keep my installation of Vim 7.3.712 on Dropbox so I can use it across multiple computers. While trying to run gVim on a new PC with Python 2.7.11 installed, gVim would close without warning or an error message when trying to open files.

Found out the cause was the one plugin I …

more ...

Automate Stdin For Python Tests

Date Tags python

NOTE: The information in this post applies to Python 2.x only. See this post for Python 3.x support.

While working on Qprompt (a Python CLI based user input libary), I wanted to write some tests to check for regressions. The following lambda function allows stdin to be programmatically set:

import StringIO, sys
sys.stdin = StringIO.StringIO()
setinput = lambda x: [sys.stdin.truncate(0), sys.stdin.write(x), sys.stdin.seek(0)]

The following …

more ...

Python Pattern Matching, Sorta

Date Tags python

This trick is neat and potentially useful although maybe not very Pythonic:

txt = "two"
val = (
        1 if txt == "one" else
        2 if txt == "two" else
        3 if txt == "three" else
print val

The following form can be used instead:

txt = "three"
val = \
        1 if txt == "one" else \
        2 if txt == "two" else \
        3 if txt == "three" else \
print val
more ...

Hi, I am Jeff Rimko!
A computer engineer and software developer in the greater Pittsburgh, Pennsylvania area.