Skip to content

Instantly share code, notes, and snippets.

@ducky427
Created May 8, 2013 20:45
Show Gist options
  • Save ducky427/5543518 to your computer and use it in GitHub Desktop.
Save ducky427/5543518 to your computer and use it in GitHub Desktop.
from macropy.macros.string_interp import macros, s
a, b = 1, 2
c = s%"%{a} apple and %{b} bananas"
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for %: 'NoneType' and 'str'
@jnhnum1
Copy link

jnhnum1 commented May 10, 2013

You can't use macros in a single file. You need to import macropy before you import your code which uses macro substitution. So in this example, you would need a main.py which looks like

import macropy.core.macros
import gistfile1

You can look at run.py to see how we run our unittests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment