aksappy aksappy - 3 years ago 143
Python Question

Python printing twice when importing facebook-sdk

Can somebody help me out with why this is happening? I have a python 3, virtualenv based environment, and I am writing some scripts with Facebook SDK.

When I write print statement before importing facebook, the print is happening only once.

Print only once!

When I write print statement after importing facebook, the print is happening twice, even though the print is written only once.

Print twice!

Answer Source

Rename your file from facebook.py to something else. As it is, it is importing itself rather than the module.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download