From 3e435e3452b41e93e87dd172afb2b11f962e2074 Mon Sep 17 00:00:00 2001 From: bhu20 Date: Wed, 7 Jan 2026 23:56:48 +0530 Subject: [PATCH 1/2] Fix setup.py dependency installation on Windows --- setup.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/setup.py b/setup.py index e10d41a..cc1f905 100644 --- a/setup.py +++ b/setup.py @@ -9,17 +9,16 @@ import os def run_command(command, description): - """Run a command and handle errors.""" print(f"🔄 {description}...") try: - result = subprocess.run(command, shell=True, check=True, capture_output=True, text=True) + subprocess.run(command, check=True) print(f"✅ {description} completed successfully!") return True except subprocess.CalledProcessError as e: print(f"❌ {description} failed!") - print(f"Error: {e.stderr}") return False + def main(): print("🚀 Setting up PyDex development environment...") print() @@ -39,15 +38,17 @@ def main(): print("✅ Virtual environment already exists") # Activate virtual environment and install requirements - if os.name == 'nt': # Windows - activate_cmd = "venv\\Scripts\\activate" - pip_cmd = "venv\\Scripts\\pip" - else: # Unix/Linux/macOS - activate_cmd = "source venv/bin/activate" - pip_cmd = "venv/bin/pip" - - if not run_command(f"{pip_cmd} install -r requirements.txt", "Installing dependencies"): + if os.name == "nt": + venv_python = os.path.join("venv", "Scripts", "python") + else: + venv_python = os.path.join("venv", "bin", "python") + + if not run_command( + [venv_python, "-m", "pip", "install", "-r", "requirements.txt"], + "Installing dependencies" + ): sys.exit(1) + print() print("🎉 Setup completed successfully!") From 7d314ba3fc5cefaa396ac3db2cd3366ebc3ed871 Mon Sep 17 00:00:00 2001 From: bhu20 Date: Wed, 7 Jan 2026 23:57:30 +0530 Subject: [PATCH 2/2] Fixed the argparse crash --- pokedex.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pokedex.py b/pokedex.py index 0cc1799..24d008b 100644 --- a/pokedex.py +++ b/pokedex.py @@ -80,7 +80,8 @@ def parse_arguments(): help="Enter the National Pokédex ID number of a Pokémon (e.g., 25 for Pikachu). " "Overrides the 'name' argument if both are provided." ) - return parser.parse_args() + args = parser.parse_args() + return parser, args def get_random_pokemon_id(): @@ -223,7 +224,7 @@ def main(): 5. Provides clear usage instructions and exits if no valid Pokémon identifier or lookup method is provided. """ - args = parse_arguments() + parser, args = parse_arguments() identifier = None if args.random: @@ -239,7 +240,7 @@ def main(): print(f"{Fore.YELLOW}Error: No Pokémon specified. Please provide a name/ID or use --random.{Style.RESET_ALL}") - parse_arguments().print_help() + parser.print_help() sys.exit(1) # Fetch Pokémon data using the determined identifier.