I have the following directory structure setup...
c:\alpha\Person .py
------------------
class Person(IPerson) :
def __init__(self):
print "Alpha person here"
c:\beta\Person. py
------------------
class Person(IPerson) :
def __init__(self):
print "Beta person here"
c:\gamma\Person .py
------------------
class Person(IPerson) :
def __init__(self):
print "Gamma person here"
c:\ok\playgroun d.py
-------------------
def tryAllThree():
a = "c:\\alpha"
b = "c:\\beta"
g = "c:\\gamma"
sys.path.append (a)
from Person import Person
alpha = Person()
sys.path.remove (a)
sys.path.append (b)
from Person import Person
beta = Person()
sys.path.remove (b)
sys.path.append (g)
from Person import Person
gamma = Person()
Notice that my three different projects (alpha, beta, gamma) have a
Person.py which contains a Person class.
When I execute the following (on windows):
c:\okpython
I see...
Alpha person here
Alpha person here
Alpha person here
What I want to see is
Alpha person here
Beta person here
Gamma person here
.....how can I get this to work?
Thanks
c:\alpha\Person .py
------------------
class Person(IPerson) :
def __init__(self):
print "Alpha person here"
c:\beta\Person. py
------------------
class Person(IPerson) :
def __init__(self):
print "Beta person here"
c:\gamma\Person .py
------------------
class Person(IPerson) :
def __init__(self):
print "Gamma person here"
c:\ok\playgroun d.py
-------------------
def tryAllThree():
a = "c:\\alpha"
b = "c:\\beta"
g = "c:\\gamma"
sys.path.append (a)
from Person import Person
alpha = Person()
sys.path.remove (a)
sys.path.append (b)
from Person import Person
beta = Person()
sys.path.remove (b)
sys.path.append (g)
from Person import Person
gamma = Person()
Notice that my three different projects (alpha, beta, gamma) have a
Person.py which contains a Person class.
When I execute the following (on windows):
c:\okpython
>>from playground import *
>>tryAllThree ()
>>tryAllThree ()
Alpha person here
Alpha person here
Alpha person here
What I want to see is
Alpha person here
Beta person here
Gamma person here
.....how can I get this to work?
Thanks
Comment