2014-10-02 3 views
1

Я создал простой модуль Python по имени nester.py:
Исходный код:Невозможно загрузить модуль PyPi

""" 
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. 

Я хочу, чтобы загрузить этот модуль на http://pypi.python.org
Так я создал следующие 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." 
    ) 

Это мой первый раз, когда я пытаюсь загрузить что-то на PyPi.
Теперь из моего Macbook pro terminal, я напечатал:

python setup.py register 

Это выход я получил:

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$ 

Почему я не разрешается хранить информацию пакета? Я зарегистрировался на PyPi уже с именем пользователя AdiSingh, а также подтвердил свою регистрацию.

Любая помощь?
Что мне не хватает?
Заранее благодарим!

+0

Позвольте мне угадать, вы читаете Head First Python? – MattDMo

+0

@MattDMo Да, я мой друг :) –

ответ

3

Прежде всего, вы должны использовать TestPyPI, если вы просто играете, главный сайт PyPI обычно зарезервирован для реальных модулей. Вам понадобится отдельный логин, просто прочитайте ссылку.

Во-вторых, searching PyPI for nester показывает, что уже есть пакет с таким именем (а также десятки подобных пакетов), поэтому вы получаете сообщение об ошибке. Перед загрузкой вам нужно будет выбрать уникальное имя для своего пакета.

Смежные вопросы