Skip to content

Instantly share code, notes, and snippets.

@KarlHerler
Created January 4, 2012 11:10
Show Gist options
  • Save KarlHerler/1559609 to your computer and use it in GitHub Desktop.
Save KarlHerler/1559609 to your computer and use it in GitHub Desktop.
Importing without specified PYTHONPATH or virtualenv (/src/lib/ and src/test/)
# Fibonacci numbers module
print "I am imported!"
def printMe():
print "From a.py"
# IGNORE, just some test methods
def fib(n): # write Fibonacci series up to n
a, b = 0, 1
while b < n:
print b,
a, b = b, a+b
def fib2(n): # return Fibonacci series up to n
result = []
a, b = 0, 1
while b < n:
result.append(b)
a, b = b, a+b
return result
import sys
sys.path.append('../') #so kill me
#print sys.path
from lib.a import printMe
printMe()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment