0 / 0 / 0
Регистрация: 06.10.2017
Сообщений: 10

Ошибка: "missing 1 required positional argument"

17.10.2017, 20:29. Показов 68239. Ответов 3
Метки нет (Все метки)

Студворк — интернет-сервис помощи студентам
Python
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
import datetime
 
class Pizza:
    def getIngredients(self):
        return self.ingredients
    def getExtraIngredients(self):
        return self.extra_ingredients
    def getTotalCost(self):
        return self.cost
    def getName(self):
        return self.name
    def __str__(self):
        return str(self.getName()) + '\n' + 'Ingredients: ' + str(self.getIngredients()) + '\n' + \
               'Extra Ingredients: ' + str(self.getExtraIngredients()) + '\n' + 'Cost: ' + str(self.getTotalCost())
 
class Margherita(Pizza):
    name = "Margherita"
    ingredients = ["tomate", "sheese", "olives", "basil"]
    cost = 79.0
    extra_ingredients = []
 
class Pepperoni(Pizza):
    name = "Pepperoni"
    ingredients = ["salami pepperoni", "momate", "mozzarella", "pepperoni pepper", "oregano", "Pomodoro sauce"]
    cost = 109.0
    extra_ingredients = []
 
class Carbonara(Pizza):
    name = "Carbonara"
    ingredients = ["ham", "champignon", "parmesan", "mozzarella", "tomatoes", "tomatoes",
                   "egg quail", "pepper", "Carbonara sauce"]
    cost = 106.0
    extra_ingredients = []
 
class Polo(Pizza):
    name = "Polo"
    ingredients = ["chicken fillet", "pineapple", "oregano", "mozzarella", "chili pepper", "Pomodoro sauce"]
    cost = 99.0
    extra_ingredients = []
 
class Four_cheeses(Pizza):
    name = "Four cheeses"
    ingredients = ["parmesan", "dork blue", "cheddar", "mozzarella", "pear", "Walnut", "creamy sauce"]
    cost = 119.0
    extra_ingredients = []
 
class Crispie(Pizza):
    name = "Crispie"
    ingredients = ["Chees Feta", "Cherry tomatoes", "sun-dried tomatoes", "champignon", "arugula", "basil"]
    cost = 139.0
    extra_ingredients = []
 
class Gurmeo(Pizza):
    name = "Gurmeo"
    ingredients = ["hunting sausages", "salami peperoni", "ham", "chicken fillet", "mushrooms", "oregano", "BBQ sauce"]
    cost = 139.0
    extra_ingredients = []
 
class Extra_Ingredients(Pizza):
    def __init__(self, pizza_component):
        self.pizza_component = pizza_component
    def getIngredients(self):
        return self.getIngredients()
    def getExtraIngredients(self):
        return self.getExtraIngredients() + Pizza.getExtraIngredients(self)
    def getTotalCost(self):
        return self.getTotalCost() + Pizza.getTotalCost(self)
    def getName(self):
        return self.name
 
class Cheese(Extra_Ingredients):
    name = "Cheese"
    cost = 12.0
    extra_ingredients = ["cheese"]
    def __init__(self, pizza_component):
        ExtraIngredients.__init__(self, pizza_component)
        self.pizza_component = components
 
class Tomatto(Extra_Ingredients):
    name = "Tomatto"
    cost = 8.0
    extra_ingredients =  ["tomate"]
    def __init__(self, pizza_component):
        ExtraIngredients.__init__(self, pizza_component)
        self.pizza_component = components
 
class Bacon(Extra_Ingredients):
    name = "Bacon"
    cost = 18.0
    extra_ingredients =  ["bacon"]
    def __init__(self, pizza_component):
        ExtraIngredients.__init__(self, pizza_component)
        self.pizza_component = components
 
class Pineapple(Extra_Ingredients):
    name = "Pineapple"
    cost = 17.0
    extra_ingredients = ["pineapple"]
    def __init__(self, pizza_component):
        Extra_Ingredients.__init__(self, pizza_component)
        self.pizza_component = components
 
class Salami(Extra_Ingredients):
    name = "Salami"
    cost = 15.0
    extra_ingredients = ["salami"]
    def __init__(self, pizza_component):
        Extra_Ingredients.__init__(self, pizza_component)
        self.pizza_component= components
 
today = datetime.date.today().weekday()
 
pizza_day = {0: Pizza.__str__(Margherita()),1: Pizza.__str__(Pepperoni()),
             2: Pizza.__str__(Carbonara()),3: Pizza.__str__(Polo()),
             4: Pizza.__str__(Four_cheeses()), 5: Pizza.__str__(Crispie()), 6 : Pizza.__str__(Gurmeo())}
 
print("Pizza of the day: ",pizza_day[today])
 
components = {1: Extra_Ingredients.__init__(Cheese()), 2: Extra_Ingredients.__init__(Tomatto()),
              3: Extra_Ingredients.__init__(Bacon()), 4: Extra_Ingredients.__init__(Pineapple()),
              5: Extra_Ingredients.__init__(Salami())}


Вылетает вот такая ошибка:
Code
1
2
3
4
Traceback (most recent call last):
  File "C:\Users\Admin\Desktop\laba_2_1.py", line 101, in <module>
    components = {1: Extra_Ingredients.__init__(Cheese()), 2: Extra_Ingredients.__init__(Tomatto()),
TypeError: __init__() missing 1 required positional argument: 'pizza_component'
Помогите разобраться

Добавлено через 45 минут
Все равно выдается такая самая ошибка

Добавлено через 17 минут
Python
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
import datetime
 
class Pizza:
    def getIngredients(self):
        return self.ingredients
    def getExtraIngredients(self):
        return self.extra_ingredients
    def getTotalCost(self):
        return self.cost
    def getName(self):
        return self.name
    def __str__(self):
        return str(self.getName()) + '\n' + 'Ingredients: ' + str(self.getIngredients()) + '\n' + \
               'Extra Ingredients: ' + str(self.getExtraIngredients()) + '\n' + 'Cost: ' + str(self.getTotalCost())
 
class Margherita(Pizza):
    name = "Margherita"
    ingredients = ["tomate", "sheese", "olives", "basil"]
    cost = 79.0
    extra_ingredients = []
 
class Pepperoni(Pizza):
    name = "Pepperoni"
    ingredients = ["salami pepperoni", "momate", "mozzarella", "pepperoni pepper", "oregano", "Pomodoro sauce"]
    cost = 109.0
    extra_ingredients = []
 
class Carbonara(Pizza):
    name = "Carbonara"
    ingredients = ["ham", "champignon", "parmesan", "mozzarella", "tomatoes", "tomatoes",
                   "egg quail", "pepper", "Carbonara sauce"]
    cost = 106.0
    extra_ingredients = []
 
class Polo(Pizza):
    name = "Polo"
    ingredients = ["chicken fillet", "pineapple", "oregano", "mozzarella", "chili pepper", "Pomodoro sauce"]
    cost = 99.0
    extra_ingredients = []
 
class Four_cheeses(Pizza):
    name = "Four cheeses"
    ingredients = ["parmesan", "dork blue", "cheddar", "mozzarella", "pear", "Walnut", "creamy sauce"]
    cost = 119.0
    extra_ingredients = []
 
class Crispie(Pizza):
    name = "Crispie"
    ingredients = ["Chees Feta", "Cherry tomatoes", "sun-dried tomatoes", "champignon", "arugula", "basil"]
    cost = 139.0
    extra_ingredients = []
 
class Gurmeo(Pizza):
    name = "Gurmeo"
    ingredients = ["hunting sausages", "salami peperoni", "ham", "chicken fillet", "mushrooms", "oregano", "BBQ sauce"]
    cost = 139.0
    extra_ingredients = []
 
class Extra_Ingredients(Pizza):
    def __init__(self, pizza_component):
        self.pizza_component = pizza_component
    def getIngredients(self):
        return self.getIngredients()
    def getExtraIngredients(self):
        return self.getExtraIngredients() + Pizza.getExtraIngredients(self)
    def getTotalCost(self):
        return self.getTotalCost() + Pizza.getTotalCost(self)
    def getName(self):
        return self.name
 
class Cheese(Extra_Ingredients):
    name = "Cheese"
    cost = 12.0
    extra_ingredients = ["cheese"]
    def __init__(self, pizza_component):
        ExtraIngredients.__init__(self, pizza_component)
        self.pizza_component = components
 
class Tomatto(Extra_Ingredients):
    name = "Tomatto"
    cost = 8.0
    extra_ingredients =  ["tomate"]
    def __init__(self, pizza_component):
        ExtraIngredients.__init__(self, pizza_component)
        self.pizza_component = components
 
class Bacon(Extra_Ingredients):
    name = "Bacon"
    cost = 18.0
    extra_ingredients =  ["bacon"]
    def __init__(self, pizza_component):
        ExtraIngredients.__init__(self, pizza_component)
        self.pizza_component = components
 
class Pineapple(Extra_Ingredients):
    name = "Pineapple"
    cost = 17.0
    extra_ingredients = ["pineapple"]
    def __init__(self, pizza_component):
        Extra_Ingredients.__init__(self, pizza_component)
        self.pizza_component = components
 
class Salami(Extra_Ingredients):
    name = "Salami"
    cost = 15.0
    extra_ingredients = ["salami"]
    def __init__(self, pizza_component):
        Extra_Ingredients.__init__(self, pizza_component)
        self.pizza_component= components
 
today = datetime.date.today().weekday()
 
pizza_day = {0: Pizza.__str__(Margherita()),1: Pizza.__str__(Pepperoni()),
             2: Pizza.__str__(Carbonara()),3: Pizza.__str__(Polo()),
             4: Pizza.__str__(Four_cheeses()), 5: Pizza.__str__(Crispie()), 6 : Pizza.__str__(Gurmeo())}
 
print("Pizza of the day: ",pizza_day[today])
 
components = {1: Extra_Ingredients.__init__(Cheese()), 2: Extra_Ingredients.__init__(Tomatto()),
              3: Extra_Ingredients.__init__(Bacon()), 4: Extra_Ingredients.__init__(Pineapple()),
              5: Extra_Ingredients.__init__(Salami())}
все равно ошибка такая же самая
0
cpp_developer
Эксперт
20123 / 5690 / 1417
Регистрация: 09.04.2010
Сообщений: 22,546
Блог
17.10.2017, 20:29
Ответы с готовыми решениями:

missing 1 required positional argument
Здравствуйте, столкнулся с проблемой, при выборе второй таблицы, нажатии кнопки добавить выдается ошибка, написання в заголовке, я уже...

Ошибка takes 1 positional argument but 33 were
Доброго времени суток. Хочу сделать Крашер сайтов для андроид нашел скрипт в интернете протестил(крашет) начал делать по андроид с...

Ошибка missing 1 required positional argument: 'self'
всем привет. в этом коде: from tkinter import* class Main(): def __init__(self): tk=Tk() tk.geometry('300x300') ...

3
Эксперт Python
 Аватар для dondublon
4653 / 2073 / 366
Регистрация: 17.03.2012
Сообщений: 10,183
Записей в блоге: 6
18.10.2017, 11:03
Цитата Сообщение от ДмитрийЗинька Посмотреть сообщение
TypeError: __init__() missing 1 required positional argument: 'pizza_component'
Перевести?
0
0 / 0 / 0
Регистрация: 06.10.2017
Сообщений: 10
18.10.2017, 19:15  [ТС]
ну давай..., а потом напиши мне пожалуйста в коде и запусти
0
Эксперт Python
 Аватар для dondublon
4653 / 2073 / 366
Регистрация: 17.03.2012
Сообщений: 10,183
Записей в блоге: 6
19.10.2017, 09:57
ДмитрийЗинька, конструктор __init__() не получил аргумент pizza_component, хотя положено.
В коде - сам, уж извини.
0
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
raxper
Эксперт
30234 / 6612 / 1498
Регистрация: 28.12.2010
Сообщений: 21,154
Блог
19.10.2017, 09:57
Помогаю со студенческими работами здесь

Ошибка: missing 1 required positional argument: 'arr'
Не получается отсортировать список методом класса from random import randint #Базовый класс class massiv1: a = ...

Ошибка TypeError: on_message() missing 1 required positional argument: 'ctx'
Пишу простенького бота для своего сервера дискорд. хотел сделать приветствие с @пингом_автора, но пишет вот такое: TypeError:...

TypeError: add_point() missing 1 required positional argument: 'y'
Всем привет! Начал писать класс для создания треугольника, но почти сразу же появилась загвоздка: при запуске кода появляется ошибка: ...

TypeError: describe_battery() missing 1 required positional argument: 'self'
class Car(): &quot;&quot;&quot;Простая модель автомобиля.&quot;&quot;&quot; def __init__(self, make, model, year): self.make = make ...

TypeError: AddCar() missing 1 required positional argument: 'self'
выдает ошибку. Условно нужно, чтобы создавать обьект машины. Вот код class Car: def __init__(self, cost, mark,...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
4
Ответ Создать тему
Опции темы

Новые блоги и статьи
AkelPad-скрипты, структуры, и немного лирики..
testuser2 05.04.2026
Такая программа, как AkelPad существует уже давно, и также давно существуют скрипты под нее. Тем не менее, прога живет, периодически что-то не спеша дополняется, улучшается. Что меня в первую очередь. . .
Отображение реквизитов в документе по условию и контроль их заполнения
Maks 04.04.2026
Алгоритм из решения ниже реализован на примере нетипового документа "ПланированиеСпецтехники", разработанного в конфигурации КА2. Данный документ берёт данные из другого нетипового документа. . .
Фото всей Земли с борта корабля Orion миссии Artemis II
kumehtar 04.04.2026
Это первое подобное фото сделанное человеком за 50 лет. Снимок называют новым вариантом легендарной фотографии «The Blue Marble» 1972 года, сделанной с борта корабля «Аполлон-17». Новое фото. . .
Вывод диалогового окна перед закрытием, если документ не проведён
Maks 04.04.2026
Алгоритм из решения ниже реализован на примере нетипового документа "СписаниеМатериалов", разработанного в конфигурации КА2. Задача: реализовать программный контроль на предмет проведения документа. . .
Программный контроль заполнения реквизитов табличной части документа
Maks 02.04.2026
Алгоритм из решения ниже реализован на примере нетипового документа "СписаниеМатериалов", разработанного в конфигурации КА2. Задача: 1. Реализовать контроль заполнения реквизита. . .
wmic не является внутренней или внешней командой
Maks 02.04.2026
Решение: DISM / Online / Add-Capability / CapabilityName:WMIC~~~~ Отсюда: https:/ / winitpro. ru/ index. php/ 2025/ 02/ 14/ komanda-wmic-ne-naydena/
Программная установка даты и запрет ее изменения
Maks 02.04.2026
Алгоритм из решения ниже реализован на примере нетипового документа "СписаниеМатериалов", разработанного в конфигурации КА2. Задача: при создании документов установить период списания автоматически. . .
Вывод данных в справочнике через динамический список
Maks 01.04.2026
Реализация из решения ниже выполнена на примере нетипового справочника "Спецтехника" разработанного в конфигурации КА2. Задача: вывести данные из ТЧ нетипового документа. . .
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2026, CyberForum.ru