Deploy-ng: "unexpected keyword argument 'exist_ok'"


#1

I’m attempting to build a distributable build of my tutorial game, and am hitting the following error:

Traceback (most recent call last):
File “setup.py”, line 25, in
“win_amd64”
File “/usr/lib/python2.7/dist-packages/setuptools/init.py”, line 129, in setup
return distutils.core.setup(**attrs)
File “/usr/lib/python2.7/distutils/core.py”, line 151, in setup
dist.run_commands()
File “/usr/lib/python2.7/distutils/dist.py”, line 953, in run_commands
self.run_command(cmd)
File “/usr/lib/python2.7/distutils/dist.py”, line 972, in run_command
cmd_obj.run()
File “/usr/local/lib/python2.7/dist-packages/direct/dist/commands.py”, line 1350, in run
os.makedirs(self.dist_dir, exist_ok=True)
TypeError: makedirs() got an unexpected keyword argument ‘exist_ok’


#2

os.makedirs() on Python 2.7 does not have an exist_ok. I will look into fixing this issue.


#3

Fair enough, and thank you! :slight_smile:

… Thinking of which, how urgent is it that I look into moving away from Python 2.7? I’ve been seeing dire warnings–even in Pip!–about support being dropped. But conversely, I’m hesitant due to uncertainty over just how much has changed, and how much work it might be to re-learn the language and, perhaps worse, convert my code… :/


#4

Python 2.7 will reach EOL (end of life) on January 1st 2020, and you will want to switch to Python 3 by then. A porting guide is available, but I do not know how good it is (I stumbled upon it when confirming the EOL date).

I believe most of the developers are using Python 3 as their main version at this point, so errors like this may become more common. Python 2 does get tested, but things that are not automated may get missed while testing on Python 2.


#5

Ah, thank you for that guide. Fair enough, then–it’s something to look into indeed, it seems. :/


#6

This was already fixed:


#7

In the grand scheme of things, not that much has changed. Python ships a 2to3 tool that can make use of most of the conversions (eg. print functions) for you. The benefits from the added features may well outweigh the cost. But either way, you will need to upgrade at some point sooner or later.

We will support Python 2.7 at least until the EOL date in 2020. I strongly recommend everyone to get their application ready for Python 3 before that date.


#8

Hmm… That’s a little reassuring, at least.

I’ve now installed “2to3”, I believe, and intend to at least perform some initial experiments into using Python 3…


#9

You can also use futurize from https://python-future.org which a great tool to make your code compatible with python 2 and 3. The documentation is well done and you can apply the tool incrementally to check that nothing is broken.


#10

Thank you. :slight_smile:

Is there a reason to support both? If Python 3 is widely-used–and either widely-available on user machines, or installed with distributable Panda3D games–would it not be simpler to support only 3?


#11

As far as I’m concerned, there’s not. It’s only interesting if you’re building a software library that you want both Python 2 and 3 users to be able to use.


#12

Fair enough. Python 3 it is, then, I think!

I’ve set my IDE to use Python 3, and I tried 2to3 on some simpler projects (including the work-in-progress tutorial), and things seem to have gone smoothly thus far. We’ll see how things go with my much-larger main project, but I’m feeling more hopeful now. :slight_smile: