Search code examples
gitgithubpypi

Registering on PyPI test site command line ValueError


Why is the below happening when I try to register my package with the test site? It registers with the regular site just fine :/

This is what happens at my command line when I attempt to register with the pypi test site:

PS C:\Users\Dave\Desktop\distributing\hellodmt2Distribution> python setup.py register -r https://testpypi.python.org
i
running register
running egg_info
writing hellodmt2.egg-info\PKG-INFO
writing top-level names to hellodmt2.egg-info\top_level.txt
writing dependency_links to hellodmt2.egg-info\dependency_links.txt
reading manifest file 'hellodmt2.egg-info\SOURCES.txt'
writing manifest file 'hellodmt2.egg-info\SOURCES.txt'
Traceback (most recent call last):
  File "setup.py", line 14, in <module>
    download_url = "https://github.com/dmt257/hellodmt2/archive/0.1.tar.gz",
  File "C:\Python27\lib\distutils\core.py", line 151, in setup
    dist.run_commands()
  File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
  File "C:\Python27\lib\site-packages\setuptools\command\register.py", line 10, in run
    orig.register.run(self)
  File "C:\Python27\lib\distutils\command\register.py", line 46, in run
    self._set_config()
  File "C:\Python27\lib\distutils\command\register.py", line 81, in _set_config
    raise ValueError('%s not found in .pypirc' % self.repository)
ValueError: https://testpypi.python.org/pypi not found in .pypirc
PS C:\Users\Dave\Desktop\distributing\hellodmt2Distribution>

My setup.py:

#!/usr/bin/env
try:
    from setuptools import setup
except importError:
    from distutils.core import setup

setup(name = "hellodmt2",
      description = "a source distribution test",
      version = "0.1",
      author = "David",
      author_email = "[email protected]",
      py_modules = ["hellodmt2"],
      url = "https://github.com/dmt257/hellodmt2",
      download_url = "https://github.com/dmt257/hellodmt2/archive/0.1.zip",
      keywords = ["testing"],

      )

This is my pypirc:

    [distutils]
index-servers=
    pypi
    pypitest

[pypitest]
repository = https://testpypi.python.org/pypi
username = dmt257
password = mypasswordhere

[pypi]
repository = https://pypi.python.org/pypi
username = dmt257
password = mypasswordhere

Solution

  • The file should be called, simply, .pypirc, not pypi.pypirc. This a Linux-style filename commonly used for configuration files. The leading dot means that it won't be shown in a normal directory listing.

    And from what I have read, the Windows equivalent of the Linux $Home directory (~) is C\Users\<logged-in-user>, so C\Users\Dave, in your case. Adding the location to your PATH won't help; this variable is only to allow Windows to find executables.

    The documentation isn't clear on where this file should go in a Windows environment, there is an old bug that mentions this file not being found in Windows because of the lack of a HOME envorinment variable. It's been 'fixed' but it's still not clear where the file should go, other than ~/.pypirc.

    I'd try renaming your file, first. If you still have issues, try moving it to your 'home' directory. Note that the Windows GUI won't let you rename a file with only an extension, so you'll have to do it from a command window:

    rename pypi.pypirc .pypirc