Home > Software engineering >  Py2exe [Errno 2] No such file or directory: 'm'
Py2exe [Errno 2] No such file or directory: 'm'

Time:08-04

I'm trying to use py2exe to create a simple exe using py2exe. Unfortunately, when I try to create even a simple py2exe, it fails.

My Python script is:

print("Hello World")

My setup script is:

from distutils.core import setup
import py2exe

setup(console="mouse-check.py")

When I run py py2exe-installer.py py2exe I get the following output:

C:\Users\...\Python\py2exe-installer.py:1: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
  from distutils.core import setup
running py2exe
error: [Errno 2] No such file or directory: 'm'

I'm using Python 3.10.4 on Windows.

My py2exe version is: 0.11.1.1

My directory structure is:

/Python
- py2exe-installer.py
- mouse-check.py

Anyone have any idea what "m" is referring to here?

CodePudding user response:

The setup function requires console argument is list, you can read more details in the implementation. Or tutorial and examples here.
Your setup script should be looked like this

from distutils.core import setup
import py2exe

setup(console=["mouse-check.py"])
  • Related