Skip to content

Commit

Permalink
fix: error handle in initial configuration (#89)
Browse files Browse the repository at this point in the history
When post installation script is triggered during installation,
the initialization check file (init.txt) is not present, which raises
an exception. This leads to the failed installation. The issue is fixed
by catching the error and suppressing it (which is okay because it is
only happening during the installation).
  • Loading branch information
myungjin authored Sep 10, 2024
1 parent 0067182 commit 5492f4b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ The framework is built on top of PyTorch, a widely-used deep learning framework,

## Installation

### Step 1: Install multiworld package

To use the latest official package,

```bash
Expand All @@ -56,12 +54,6 @@ To install the package from source,
pip install .
```

### Step 2: Run post installation script

```bash
m8d-post-setup
```

## Running Examples

The list of all examples that are available can be found in the [`examples`](/examples) folder.
Expand Down
12 changes: 10 additions & 2 deletions multiworld/post_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,21 @@


def configure_once():
"""Configure multiworld once when it is used for the first time."""
package_name = __name__.split(".")[0]
path_to_sitepackages = site.getsitepackages()[0]

init_file_path = os.path.join(path_to_sitepackages, package_name, "init.txt")

with open(init_file_path, "r") as file:
patch_applied = file.read()
try:
with open(init_file_path, "r") as file:
patch_applied = file.read()
except FileNotFoundError:
message = "WARNING: initialization check file not found; "
message += f"{package_name} is not installed correctly; "
message += "please reinstall."
print(message)
return

if patch_applied == "true":
return
Expand Down

0 comments on commit 5492f4b

Please sign in to comment.