0

I am new to python and I am trying to make an exe file, using py2exe, from a python code I made. I made the following setup.py file following a tutorial on how to use py2exe:

from distutils.core import setup
from glob import glob
import py2exe

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

data_files = [("msvcr90.dll", glob(r'C:\Windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91\msvcr90.dll\*.*'))]
setup(data_files=data_files, etc)

sys.path.append("C:\Windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91\msvcr90.dll")

When I try to run it in cmd I get the following error:

SyntaxError: non-keyword arg after keyword arg

I have read several other posts on this error basically saying that I should have the "etc" before "data_files". However when I do this, I get a name error undefined name sys.

I want to include msvcr90.dll file with the setup.py

Any ideas on how to fix this?

1
  • 1
    import sys at the beginning, and the etc before data_files? Commented Jun 24, 2016 at 17:25

1 Answer 1

2

I have read several other posts on this error basically saying that I should have the "etc" before "data_files". However when I do this, I get a name error undefined name sys

That IS the solution to this problem, though you will then encounter the same error with etc as it is not defined anywhere (I believe it is meant to be an example to show that setup can accept other arguments, and not meant to be used literally in your code).

You are getting undefined name sys because that is another, unrelated issue in your code.

You should add import sys.

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

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

data_files = [("msvcr90.dll", glob(r'C:\Windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91\msvcr90.dll\*.*'))]
setup(data_files=data_files)

sys.path.append("C:\Windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91\msvcr90.dll")
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks! Yeah that worked, but now I have undefined name etc. Honestly I am not sure why etc is needed, It's just how it is on the tutorial
@MarcoNunez I believe it is meant to be an example to show that setup can accept other arguments, and not meant to be used literally in your code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.