ozgur/python-firebase

python code running several times when run through command line

Opened this issue · 4 comments

I'm running a simple script with just a firebase import and am running into an issue where it runs the code several times over multiple threads.

#! python

from firebase import firebase
import sys

print "Hello"
print (sys.version)

returns the following:

C:\>python test.py
Hello
2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)]
Bye
Hello
2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)]
ByeHH
elloello

22.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)].7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)]

BByeye

Hello
2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)]
Bye
Hello
2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)]
Bye

whereas

#! python

import sys

print "Hello"
print (sys.version)

returns the correct:

Hello
2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)]

I'm running python 2.7.10 on Windows 10 in the command line.

I have the same problem. Do you have a solution?

def main(argv):
   # your code here

if __name__ == '__main__':
  main(sys.argv)

solves the problem

@doczoidberg The above fix is not working for me . I am using it with tkinter and evertime i closes the windows it opens 5 more instance of it . https://stackoverflow.com/questions/48682310/python-pyinstaller-exe-opens-multiple-instance-of-tkinter-window-python-firebas
Here is the demo video https://vimeo.com/254817308

Hi, currently i'm experiencing the same problem with Python 2.7.14 and Windows 10.
Apparently the problem is on the module load... i've tried to comment all lines and the behavior was the same 'till i comment the import line.

So, to test I`ve created a simple script that look likes this:

image

And when I run it, the symptom is:

python-problem

Weirdly, If I try to run the same script on Linux I have no problem.