Task issue

Post your Gambas programming questions here.
Post Reply
User avatar
cogier
Site Admin
Posts: 1118
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Task issue

Post 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 67 times
User avatar
BruceSteers
Posts: 1523
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Task issue

Post 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
Attachments
Test (2)-0.0.1.tar.gz
(12.34 KiB) Downloaded 68 times
If at first you don't succeed , try doing something differently.
BruceS
User avatar
BruceSteers
Posts: 1523
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Task issue

Post 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.
If at first you don't succeed , try doing something differently.
BruceS
User avatar
cogier
Site Admin
Posts: 1118
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Task issue

Post by cogier »

Thanks, Bruce. This is now working as I expected. :D
Post Reply