Search code examples
pythonpython-3.4pypi

Cannot upload module to PyPi


I created a simple module in Python named nester.py:
Source Code:

"""
This function prints a Python list, which may contain nested lists,
in a sweet format.
This function takes one required and two optional parameters. 

Required:
=========
    1> bigList - The list that may or may not contain nested lists.

Optional:
=========
    1> level - The level of the indent.
    2> indent - If a list is to be indented or not.    
"""
def nester(bigList, level = 0, indent = False):

    for items in bigList:                    # Traverse through each item.
        if isinstance(items, list):          # If the current item is a nested list,
            nester(items, level + 1, indent) # Recurse with the nested list and +1 indent level.
        else:                                # Else,
            if indent:                       # Check if indent is desired,
                for nest in range(level):    
                    print("\t", end = '')    # Print `level` numbers of '\t' characters.  
            print(items)                     # Finally print atomic item in the list.  

I wish to upload this module on http://pypi.python.org
So I created the following setup.py:

from distutils.core import setup

setup(
          name = "nester",
          version = "1.0.0",
          py_modules = ["nester"],
          author = "Aditya R.Singh",
          author_email = "[email protected]",
          url = "http://adirascala.site50.net",
          description = "A sweet printer of nested Python lists."  
     )  

This is my first time I am trying to upload something on PyPi.
Now from my Macbook pro terminal, I typed:

python setup.py register

This was the output I got:

Adityas-MacBook-Pro:nester aditya$ python setup.py register
running register
running check
We need to know who you are, so please choose either:
 1. use your existing login,
 2. register as a new user,
 3. have the server generate a new password for you (and email it to you), or
 4. quit
Your selection [default 1]: 
1
Username: AdiSingh
Password: 
Registering nester to https://pypi.python.org/pypi
Server response (403): You are not allowed to store 'nester' package information  
Adityas-MacBook-Pro:nester aditya$ 

Why am I not allowed to store package information? I did sign up on PyPi already with the username AdiSingh and also confirmed my registration.

Any help?
What am I missing?
Thanks in advance!


Solution

  • First off, you should be using TestPyPI if you're just playing around, the main PyPI site is generally reserved for real modules. You'll need a separate login, just read through the link.

    Second, searching PyPI for nester reveals that there is already a package with that name (as well as dozens of similar packages), which is why you're getting the error. You'll need to choose a unique name for your package before uploading.