Search code examples
pythonpython-3.4py2exe

No such file or directory after creating a .exe file - Python


I've made a script which will make a new post for the user in his facebook profile. It worked fine before using py2exe but after creating the .exe file it keeps giving me the same error.

Code:

import facebook, time

try:
    token = input("Your Token: ")
    text = input("The new post: ")
    graph = facebook.GraphAPI(token)
    fb_response = graph.put_wall_post(text)

except Exception as e:
    print(e)
    time.sleep(50)

Error:

[Errno 2] No such file or directory

Note: The .pyc (Python compiled file) is working fine without any errors. Only the .exe file is giving the error.


Solution

  • Problem solved. I've just used PyInstaller and it work fine. Thanks any way