Skip to content

Commit f88393a

Browse files
Merge pull request #28 from hsaunders1904/fix_potential_unboundlocal_error
Fix potential unboundlocal error
2 parents b46afb1 + 0486d19 commit f88393a

File tree

2 files changed

+573
-296
lines changed

2 files changed

+573
-296
lines changed

pyautoenv.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ def main(sys_args: List[str], stdout: TextIO) -> int:
9898
logger.debug("main(%s)", sys_args)
9999
args = parse_args(sys_args, stdout)
100100
if not os.path.isdir(args.directory):
101-
logger.warning("path '%s' is not a directory", args.directory)
101+
if __debug__:
102+
logger.warning("path '%s' is not a directory", args.directory)
102103
return 1
103104
new_activator = discover_env(args)
104105
active_env_dir = active_environment()
@@ -473,6 +474,7 @@ def iter_candidate_activators(env_directory: str, args: Args) -> Iterator[str]:
473474
for script in ("activate.ps1", "Activate.ps1"):
474475
script_path = os.path.join(env_directory, bin_dir, script)
475476
yield script_path
477+
return
476478
else:
477479
script = "activate"
478480
yield os.path.join(env_directory, bin_dir, script)

0 commit comments

Comments
 (0)