IndentationError: unexpected unindent
Сделал код:
await state.update_data(here_position_owner=message.text)
@dp.message_handler(IsAdmin(), content_types="photo" state="here_position_photo")
async def product_position_create_photo(message: Message state: FSMContext):
async with state.proxy() as data:
position_name = clear_html(data['here_position_name'])
position_price = data['here_position_price']
category_id = data['here_cache_change_category_id']
position_description = data['here_position_description']
await state.finish()
Ошибка:
File "<string>", line 371
@dp.message_handler(IsAdmin(),
content_types="photo" state="here_position_photo")
IndentationError: unexpected unindent
Ответы (1 шт):
Автор решения: Pet Linux
→ Ссылка
Ошибка эта не простая, потому что там в принципе и нет проблем с индентацией.
Конкретно в этом случае вам нужно поставить запятые там, где они нужны:
await state.update_data(here_position_owner=message.text)
@dp.message_handler(IsAdmin(), content_types="photo", state="here_position_photo") # №1 тут
async def product_position_create_photo(message: Message, state: FSMContext): # №2 тут.
async with state.proxy() as data:
position_name = clear_html(data['here_position_name'])
position_price = data['here_position_price']
category_id = data['here_cache_change_category_id']
position_description = data['here_position_description']
await state.finish()
Обязательно всегда следите за синтаксисом кода. Любой неправильный символ в коде может обернуться непонятной с первого раза ошибкой. И невнимательность может обернуться опасной уязвимостью.