rearranged the code to avoid further errors

pull/280/head
iaacornus 3 years ago
parent a8e3010540
commit ad8fa7b63b
No known key found for this signature in database
GPG Key ID: 281739AE7252598C

@ -38,15 +38,15 @@ def main(subreddit_=None, background=None, filename=None, thread_link_=None):
+ " reach out to me on Twitter or submit a GitHub issue." + " reach out to me on Twitter or submit a GitHub issue."
) )
configured = True
if not os.path.exists(".env"): if not os.path.exists(".env"):
shutil.copy(".env.template", ".env") shutil.copy(".env.template", ".env")
console.print( console.print(
"[bold red] Your .env file is invalid, or was never created. Standby.[/bold red]" "[bold red] Your .env file is invalid, or was never created. Standby.[/bold red]"
) )
console.print("[bold green]Checking environment variables...[/bold green]") console.print("[bold]Checking environment variables...[/bold]")
configured = True
for val in REQUIRED_VALUES: for val in REQUIRED_VALUES:
if not os.getenv(val): if not os.getenv(val):
print_substep( print_substep(
@ -54,15 +54,15 @@ def main(subreddit_=None, background=None, filename=None, thread_link_=None):
) )
configured = False configured = False
if configured: try:
try: float(os.getenv("OPACITY"))
float(os.getenv("OPACITY")) except:
except: console.print(
console.print( f"[bold red]Please ensure that OPACITY is between 0 and 1 in .env file.[/bold red]"
f"[bold red]Please ensure that OPACITY is between 0 and 1 in .env file.[/bold red]" )
) raise SystemExit()
raise SystemExit()
if configured:
console.print("[bold green]Enviroment Variables are set! Continuing...[/bold green]") console.print("[bold green]Enviroment Variables are set! Continuing...[/bold green]")
reddit_object = get_subreddit_threads(subreddit_, thread_link_) reddit_object = get_subreddit_threads(subreddit_, thread_link_)

Loading…
Cancel
Save