Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnboundLocalError: local variable 'process' referenced before assignment #1882

Open
jongiddy opened this issue Jul 9, 2020 · 0 comments
Open

Comments

@jongiddy
Copy link
Contributor

jongiddy commented Jul 9, 2020

It's possible for capture_both/run to fail here, and process is not defined in the exception handler.

if pipe_output:
process = sarge.capture_both(args, cwd=cwd, env=env, async_=True)
while all(
command.returncode is None for command in process.commands
):
_read_output(process=process)
process.poll_all()
time.sleep(0.05)
_read_output(process=process)
else:
process = sarge.run(args, cwd=cwd, env=env, async_=True)
stdout_logger.flush()
stderr_logger.flush()
# stderr/stdout are not readable anymore which usually means
# that the child process has exited. However, the child
# process has not been wait()ed for yet, i.e. it has not yet
# been reaped. That is, its exit status is unknown. Read its
# exit status
process.wait()
except Exception: # pragma: no cover pylint: disable=broad-except
for popen_process in process.processes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant