ERROR: Exception:
Traceback (most recent call last):
File "C:\Users\romas\PycharmProjects\pythonProject2\venv\Lib\site-packages\pip\_internal\cli\base_command.py", line 160, in exc_logging_wrapper
status = run_func(*args)
^^^^^^^^^^^^^^^
File "C:\Users\romas\PycharmProjects\pythonProject2\venv\Lib\site-packages\pip\_internal\cli\req_command.py", line 247, in wrapper
return func(self, options, args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\romas\PycharmProjects\pythonProject2\venv\Lib\site-packages\pip\_internal\commands\install.py", line 326, in run
session = self.get_default_session(options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\romas\PycharmProjects\pythonProject2\venv\Lib\site-packages\pip\_internal\cli\req_command.py", line 98, in get_default_session
self._session = self.enter_context(self._build_session(options))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\romas\PycharmProjects\pythonProject2\venv\Lib\site-packages\pip\_internal\cli\req_command.py", line 125, in _build_session
session = PipSession(
^^^^^^^^^^^
File "C:\Users\romas\PycharmProjects\pythonProject2\venv\Lib\site-packages\pip\_internal\network\session.py", line 343, in __init__
self.headers["User-Agent"] = user_agent()
^^^^^^^^^^^^
File "C:\Users\romas\PycharmProjects\pythonProject2\venv\Lib\site-packages\pip\_internal\network\session.py", line 175, in user_agent
setuptools_dist = get_default_environment().get_distribution("setuptools")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\romas\PycharmProjects\pythonProject2\venv\Lib\site-packages\pip\_internal\metadata\importlib\_envs.py", line 188, in get_distribution
return next(matches, None)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\romas\PycharmProjects\pythonProject2\venv\Lib\site-packages\pip\_internal\metadata\importlib\_envs.py", line 183, in
matches = (
^
File "C:\Users\romas\PycharmProjects\pythonProject2\venv\Lib\site-packages\pip\_internal\metadata\base.py", line 612, in iter_all_distributions
for dist in self._iter_distributions():
File "C:\Users\romas\PycharmProjects\pythonProject2\venv\Lib\site-packages\pip\_internal\metadata\importlib\_envs.py", line 176, in _iter_distributions
for dist in finder.find_eggs(location):
File "C:\Users\romas\PycharmProjects\pythonProject2\venv\Lib\site-packages\pip\_internal\metadata\importlib\_envs.py", line 144, in find_eggs
yield from self._find_eggs_in_dir(location)
File "C:\Users\romas\PycharmProjects\pythonProject2\venv\Lib\site-packages\pip\_internal\metadata\importlib\_envs.py", line 111, in _find_eggs_in_dir
from pip._vendor.pkg_resources import find_distributions
File "C:\Users\romas\PycharmProjects\pythonProject2\venv\Lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2164, in
register_finder(pkgutil.ImpImporter, find_on_path)
^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "C:\Users\romas\PycharmProjects\pythonProject2\venv\Lib\site-packages\pip\__main__.py", line 31, in
sys.exit(_main())
^^^^^^^
File "C:\Users\romas\PycharmProjects\pythonProject2\venv\Lib\site-packages\pip\_internal\cli\main.py", line 70, in main
return command.main(cmd_args)
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\romas\PycharmProjects\pythonProject2\venv\Lib\site-packages\pip\_internal\cli\base_command.py", line 101, in main
return self._main(args)
^^^^^^^^^^^^^^^^
File "C:\Users\romas\PycharmProjects\pythonProject2\venv\Lib\site-packages\pip\_internal\cli\base_command.py", line 216, in _main
self.handle_pip_version_check(options)
File "C:\Users\romas\PycharmProjects\pythonProject2\venv\Lib\site-packages\pip\_internal\cli\req_command.py", line 179, in handle_pip_version_check
session = self._build_session(
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\romas\PycharmProjects\pythonProject2\venv\Lib\site-packages\pip\_internal\cli\req_command.py", line 125, in _build_session
session = PipSession(
^^^^^^^^^^^
File "C:\Users\romas\PycharmProjects\pythonProject2\venv\Lib\site-packages\pip\_internal\network\session.py", line 343, in __init__
self.headers["User-Agent"] = user_agent()
^^^^^^^^^^^^
File "C:\Users\romas\PycharmProjects\pythonProject2\venv\Lib\site-packages\pip\_internal\network\session.py", line 175, in user_agent
setuptools_dist = get_default_environment().get_distribution("setuptools")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\romas\PycharmProjects\pythonProject2\venv\Lib\site-packages\pip\_internal\metadata\importlib\_envs.py", line 188, in get_distribution
return next(matches, None)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\romas\PycharmProjects\pythonProject2\venv\Lib\site-packages\pip\_internal\metadata\importlib\_envs.py", line 183, in
matches = (
^
File "C:\Users\romas\PycharmProjects\pythonProject2\venv\Lib\site-packages\pip\_internal\metadata\base.py", line 612, in iter_all_distributions
for dist in self._iter_distributions():
File "C:\Users\romas\PycharmProjects\pythonProject2\venv\Lib\site-packages\pip\_internal\metadata\importlib\_envs.py", line 176, in _iter_distributions
for dist in finder.find_eggs(location):
File "C:\Users\romas\PycharmProjects\pythonProject2\venv\Lib\site-packages\pip\_internal\metadata\importlib\_envs.py", line 144, in find_eggs
yield from self._find_eggs_in_dir(location)
File "C:\Users\romas\PycharmProjects\pythonProject2\venv\Lib\site-packages\pip\_internal\metadata\importlib\_envs.py", line 111, in _find_eggs_in_dir
from pip._vendor.pkg_resources import find_distributions
File "C:\Users\romas\PycharmProjects\pythonProject2\venv\Lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2164, in
register_finder(pkgutil.ImpImporter, find_on_path)
^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
import pygame
import random
import os
from pl import *
# настройка папки ассетов
game_folder = os.path.dirname(__file__)
img_folder = os.path.join(game_folder, 'img')
player_img = pygame.image.load(os.path.join(img_folder, 'p1_jump.png')).convert()
player = Player(player_img)
WIDTH = 800
HEIGHT = 650
FPS = 30
# Задаем цвета
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
# Создаем игру и окно
pygame.init()
pygame.mixer.init()
screen = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("My Game")
clock = pygame.time.Clock()
all_sprites = pygame.sprite.Group()
all_sprites.add(player)
player_img = pygame.image.load(os.path.join(img_folder, 'p1_jump.png')).convert()
# Цикл игры
running = True
while running:
# Держим цикл на правильной скорости
clock.tick(FPS)
# Ввод процесса (события)
for event in pygame.event.get():
# check for closing window
if event.type == pygame.QUIT:
running = False
# Обновление
all_sprites.update()
# Рендеринг
screen.fill(BLACK)
all_sprites.draw(screen)
# После отрисовки всего, переворачиваем экран
pygame.display.flip()
pygame.quit()
import pygame
import random
import os
class Play(pygame.sprite.Sprite):
def __init__(self):
pygame.sprite.Sprite.__init__(self)
self.image = player_img
self.image.set_colorkey(BLACK)
self.rect = self.image.get_rect()
self.rect.center = (WIDTH / 2, HEIGHT / 2)
def update(self):
self.rect.x += 5
if self.rect.left > WIDTH:
self.rect.right = 0
File "C:\Users\sobol\OneDrive\Рабочий стол\python\game\main.py", line 10, in <module>
player_img = pygame.image.load(os.path.join(img_folder, 'p1_jump.png')).convert()
pygame.error: No video mode has been set