Page 1 of 1

Task issue

Posted: Sunday 11th September 2022 2:42pm
by cogier
I can use a shell command without issue: -
Public sUrl As String = "https://www.youtube.com/watch?v=Gu9sqZZOiR0&t=66s"

Public Sub Form_Open()

  Shell "youtube-dl " & sUrl Wait ''This works

End
I would like to do this in a Task but when I try I get 40+ error lines like this: -

Code: Select all

Traceback (most recent call last):
  File "/usr/bin/youtube-dl", line 33, in <module>
    sys.exit(load_entry_point('youtube-dl==2021.4.26', 'console_scripts', 'youtube-dl')())
  File "/usr/lib/python3/dist-packages/youtube_dl/__init__.py", line 479, in main
    _real_main(argv)....
Any ideas?

Sample program attached.
Test-0.0.1.tar.gz
(12.18 KiB) Downloaded 72 times

Re: Task issue

Posted: Monday 12th September 2022 12:06am
by BruceSteers
Here ye go fella.

I guess like ffmpeg tools just using gambas shell is not enough. You HAVE to use the Process pointer and use the Output/Input flags

I found with your command just using Output and not input gave me a download and not an error
also Shell failed and i had to use Exec


Have attached your example with the GetVideo task using the process pointer and using Process_Read event

Re: Task issue

Posted: Monday 12th September 2022 12:12am
by BruceSteers
Note:
Using..
hProc = Exec ["youtube-dl", sUrl] For Input Output As "Process"

(with Input) it gave an error but it was the same error i got when the Shell command ran in Form_Open() in FMain startup so with Input Output it worked the same.

Re: Task issue

Posted: Monday 12th September 2022 4:13pm
by cogier
Thanks, Bruce. This is now working as I expected. :D