Skip to content

Commit

Permalink
Autofix pywin32 + Release 0.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
yannbouteiller committed May 1, 2022
1 parent 8aac53b commit d83b86a
Show file tree
Hide file tree
Showing 4 changed files with 804 additions and 3 deletions.
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def url_retrieve(url: str, outfile: Path, overwrite: bool = False):
]

if platform.system() == "Windows":
install_req.append('pywin32')
install_req.append('pywin32>=303')
install_req.append('vgamepad')

# The directory containing this file
Expand All @@ -123,13 +123,13 @@ def url_retrieve(url: str, outfile: Path, overwrite: bool = False):

setup(
name='tmrl',
version='0.1.4',
version='0.1.6',
description='Autonomous racing in Trackmania',
long_description=README,
long_description_content_type='text/markdown',
keywords='reinforcement learning, trackmania, self driving, roborace',
url='https://github.com/trackmania-rl/tmrl',
download_url='https://github.com/trackmania-rl/tmrl/archive/refs/tags/v0.1.4.tar.gz',
download_url='https://github.com/trackmania-rl/tmrl/archive/refs/tags/v0.1.6.tar.gz',
author='Yann Bouteiller, Edouard Geze',
author_email='[email protected], [email protected]',
license='MIT',
Expand Down
21 changes: 21 additions & 0 deletions tmrl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,27 @@
import sys
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)

import platform
if platform.system() == "Windows":
# fix pywin32 in case it fails to import:
try:
import win32gui
import win32ui
import win32con
except ImportError as e1:
logging.info("pywin32 failed to import. Attempting to fix pywin32 installation...")
from tmrl.tools.init_package.init_pywin32 import fix_pywin32
try:
fix_pywin32()
import win32gui
import win32ui
import win32con
except ImportError as e2:
logging.error(f"tmrl could not fix pywin32 on your system. The following exceptions were raised:\
\n=== Exception 1 ===\nstr(e1)\n=== Exception 2 ===\nstr(e2)\
\nPlease install pywin32 manually.")
raise RuntimeError("Please install pywin32 manually: https://github.com/mhammond/pywin32")

# standard library imports
from dataclasses import dataclass
# from tmrl.networking import Server, RolloutWorker, Trainer
Expand Down
Empty file.
Loading

0 comments on commit d83b86a

Please sign in to comment.