-1

I have this code:

with gui.Download:
if gui.is_running:  
    try: 
        dialog = str( QFileDialog.getExistingDirectory() )
    else:
        subprocess.call(['/bin/youtube-dl', gui.url])

and whenever I run it I get an error on the else block in the try, else statement. Any ideas?

Error:

      File "init.py", line 15
    else:
    ^
SyntaxError: invalid syntax

Red
  • 26,798
  • 7
  • 36
  • 58
reesericci
  • 53
  • 1
  • 8

1 Answers1

0

I just ended up using an if statement instead, works great!

if gui.is_running:
    dialog = str( QFileDialog.getExistingDirectory() )
    if dialog == '':
        pass
    else:
        subprocess.call(['/bin/youtube-dl', gui.url])
reesericci
  • 53
  • 1
  • 8