Armster
Armster

Reputation: 889

py2exe - FATAL ERROR: Could not locate script

When I generate a script in py2exe, it generates the exe but when I open the exe, I am presented with this error:

Could not locate script resource: The specified 
resource type cannot be found in the image file.

FATAL ERROR: Could not locate script

Here is my setup.py:

from distutils.core import setup
from setuptools import setup
import py2exe
import sys

sys.argv.append('py2exe')

setup(console=['program.py'])

And here is the what the command prompt pops out when I run the command to generate the exe (python setup.py py2exe):

running build
running py2exe

  6 missing Modules
  ------------------
? pkg_resources.extern.appdirs        imported from pkg_resources
? pkg_resources.extern.packaging      imported from pkg_resources
? pkg_resources.extern.six            imported from pkg_resources, pkg_resources.py31compat
? readline                            imported from cmd, code, pdb
? win32api                            imported from platform
? win32con                            imported from platform
Building 'dist\program.exe'.
error: [WinError 87] The parameter is incorrect.

I am searching all over the place but can't find the answer.

Thanks, Peppa

EDIT: I honestly don't know if this is a problem of py2exe or something is wrong internally in my python installation or operating system. I welcome all advice and recommendations.

Upvotes: 1

Views: 1505

Answers (1)

Oliver.R
Oliver.R

Reputation: 1368

In your setup.py you have two lines of the format from foo import setup - this will result in a conflict. What happens if you strip this setup.py back to the minimal example provided in the Tutorial?

from distutils.core import setup
import py2exe

setup(console=['program.py'])

If that doesn't help, it suggests the problem may lie in your environment.

Upvotes: 1

Related Questions