Spaces:
Sleeping
Sleeping
| import os | |
| import subprocess | |
| import sys | |
| print("Installing BrowserGym dependencies...") | |
| subprocess.run("cd BrowserGym && make install", shell=True, check=True) | |
| print("BrowserGym installation completed successfully") | |
| # Add BrowserGym directory to sys.path directly | |
| current_dir = os.path.dirname(os.path.abspath(__file__)) | |
| browsergym_path = os.path.join(current_dir, "BrowserGym") | |
| print(f"Added BrowserGym path: {browsergym_path}") | |
| # Prepare env with updated PYTHONPATH | |
| env = os.environ.copy() | |
| env["PYTHONPATH"] = f"{browsergym_path}:{env.get('PYTHONPATH', '')}" | |
| # π Now run app.py in a clean subprocess with correct PYTHONPATH | |
| subprocess.run([sys.executable, "app_.py"], env=env) |