For a project structure like this:
/tumblr
/tumblr
/module_foo
__init__.py
submodule_foo.py
/module_bar
__init__.py
submodule_bar.py
__init__.py
bot.py
I was doing something like that:
import sys
sys.path.append('C:\\repos\\bot\\tumblr\\tumblr')
from tumblr.bot import Bot
class SubmoduleFoo(Bot):
def __init__(self):
super().__init__()
# ...
# ...
if __name__ == "__main__":
SubmoduleFoo()
The bot.py only defines a an empty class with some initializations:
import sys
sys.path.append('C:\\repos\\bot\\tumblr\\tumblr')
class Bot:
def __init__(self):
self.settings = dict()
# ...
If I call these scripts from command line they work:
python C:\path\to\submodule_foo.py
If I doubleclick my python submodule_foo.py
"script" It doesn't work.
I think the problem Is caused by the inheritance, and calling the parent init
But since I'm just doubleclicking it, I don't know how to debug it properly.
I tried to include a:
with open('codes.txt', 'a') as file:
file.write("It Works \n")
Just after the if __name__ == "__main__":
statement and doesn't work :$
My PATH
variable (in windows 10) includes the c:\python34
and c:\python34\scripts
I also have a PYHOME
env variable that points to c:\python34
And I have already tried this solution: Python scripts stopped running on double-click in Windows But it doesn't work for me.
I also tried to create these classes throught the python interpreter. And the import to tumblr.bot.Bot() was working
I'm running out of Ideas.