GHC 2018-11-03

7 comments.

, https://git.io/fxhcr in pypa/setuptools
(Happened to post the same thing at the same time...)

, https://git.io/fxhco in pypa/setuptools
Actually, `pip install .` builds a wheel first, so it's still an egg vs wheel problem.

, https://git.io/fxhcK in pypa/setuptools
Just tried all four:

- `python setup.py install` — doesn't work;
- `python setup.py develop` — doesn't work;
- `pip install .` — works;
- `pip install -e .` — doesn't work.

So, gladly `pip` does better at non-editable install, but editable install is still up in the air.

, https://git.io/fxhc6 in pypa/setuptools
Note sure I follow. This is not only an issue with editable installs — I mean, `python setup.py install` is not editable.

, https://git.io/fxhci in pypa/setuptools
Oh I missed the PR. Thanks for the pointer.

, https://git.io/fxhZC in pypa/setuptools
Just experienced this myself when I upgraded to Python 3.7.1. This is due to a regression in `ntpath.abspath` in 3.7.1 — [bpo-31047](https://bugs.python.org/issue31047), and addressed in [GH-10082](https://github.com/python/cpython/pull/10082), which has already landed. But the damage is done. Seeing that this is a Python regression, I'm not sure what's the best resolution either.

, https://git.io/fxhZW in pypa/setuptools
[Windows] UTF-8 command line args reduced to CP1252 with console script installed from egg (but wheel works fine)
=================================================================================================================

I noticed this bug when porting my app to Windows (details of my environment can be found at the end).

Consider the following single-module distribution:

`setup.py`:

```py
#!/usr/bin/env python3

import setuptools


setuptools.setup(
    name='sysargv',
    version='0.1',
    py_modules=['sysargv'],
    entry_points={
        'console_scripts': [
            'sysargv=sysargv:sysargv',
            'callsysargv=sysargv:callsysargv',
        ],
    },
)
```

`sysargv.py`:

```py
import subprocess
import sys


def sysargv():
    print(sys.argv)


def callsysargv():
    args = ['sysargv', '\u4E2D\u6587']
    print('>', ' '.join(args))
    subprocess.call(args)
```

When I install this on Windows as an egg with `python setup.py install`, here's what happens:

```console
$ callsysargv
> sysargv 中文
['C:\\Python37\\Scripts\\sysargv', '??']
```

Note the Chinese characters becomes `??` when received by `sysargv`.

However, when I install this on Windows as a wheel with `python setup.py bdist_wheel` followed by `pip install .\dist\sysargv-0.1-py3-none-any.whl`, it works correctly:

```console
$ callsysargv
> sysargv 中文
['C:\\Python37\\Scripts\\sysargv', '中文']
```

It's good to have a workaround, but it does mean I currently can't install my package as editable during development, which is quite annoying.

I'm honestly not exactly sure setuptools is to blame here, but I know precious little about Windows and not much more about eggs either, so I figured I'll ask the experts before wasting my time digging into this. Thanks.

---

My environment: I'm running Python 3.7.1 from Chocolatey (the package is based on the NuGet python package, which presumably uses an official python.org installer) on latest Windows 10.

- setuptools version: 40.5.0
- pip version: 18.1