WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: [Solved] TC64 14x is it normal for python3.9 to need full pathway to a script?  (Read 1436 times)

aus9

  • Guest
Hi

I am packaging a python script and made python3.9 its dep.
currently if I run
Code: [Select]
echo $PATH
/home/tc/.local/bin:/usr/local/sbin:/usr/local/bin:/apps/bin:/usr/sbin:/usr/bin:/sbin:/bin:/etc/sysconfig/tcedir/ondemand
tc@box:~$

but if I run new TCE
Code: [Select]
python3 yt-dlp --no-check-certificate -x https://youtu.be/V-oquRLcmAM
python3: can't open file '/home/tc/yt-dlp': [Errno 2] No such file or directory

I can get around that error easily enough but it needs full pathway to script

Code: [Select]
python3 /usr/local/bin/yt-dlp --no-check-certificate -x https://youtu.be/V-oquRLcmAM
[youtube] Extracting URL: https://youtu.be/V-oquRLcmAM
[youtube] V-oquRLcmAM: Downloading webpage
[youtube] V-oquRLcmAM: Downloading android player API JSON
[info] V-oquRLcmAM: Downloading 1 format(s): 251
[dashsegments] Total fragments: 1
[download] Destination: Cara Dillon - Craigie Hill [V-oquRLcmAM].webm
[download] 100% of    5.49MiB in 00:00:01 at 4.05MiB/s
[ExtractAudio] Destination: Cara Dillon - Craigie Hill [V-oquRLcmAM].opus
Deleting original file Cara Dillon - Craigie Hill [V-oquRLcmAM].webm (pass -k to keep)

thanks for reading

(2) I know I can avoid the -no-check string by loading ca-certificates

« Last Edit: May 03, 2023, 08:20:12 AM by Rich »

Offline CNK

  • Wiki Author
  • Sr. Member
  • *****
  • Posts: 281
Surely what you really want is to just do without the python3 command entirely?
Code: [Select]
yt-dlp --no-check-certificate -x https://youtu.be/V-oquRLcmAM

The first line of the executable (which is actually a zip file) launches the interpreter. youtube-dl uses:
Code: [Select]
$ head -n 1 /usr/local/bin/youtube-dl
#!/usr/bin/env python

So if it's not running just by typing yt-dlp, check that your executable has such a line at the start by running "head -n 1" on it as above (otherwise you probably used the wrong download link), and if it just says python there instead of python3 (like youtube-dl does) then maybe:
Code: [Select]
sudo ln -s /usr/local/bin/python3 /usr/local/bin/python

aus9

  • Guest
CNK
Code: [Select]
head -n 1 /tmp/tcloop/yt-dlp/usr/local/bin/yt-dlp
#!/usr/bin/env python3

I did the test without full reboot and needed full pathway to /usr/local/bin as reported OP

For reasons I can not explain...its now working both without a python preface nor with full pathway to usr loc bin

thankyou

Hi Rich

Please mark as solved

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11618
Hi aus9
... I did the test without full reboot and needed full pathway to /usr/local/bin as reported OP ...
Sometimes after loading an extension you will get a "No such file or directory"  message. In cases
where the extension contains GNU versions of busybox commands, you may find the busybox
commands being executed instead of the newly loaded GNU versions.

This seems to happen when loading an extension while working in an already open terminal. I've
never really looked into it, but I think it has something to do with command history being cached
and hashed. So basically when you run grep, it finds busyboxes  /usr/grep  and remembers  grep
means  /usr/grep.  You then load  grep.tcz  but the terminal still has  grep  cached as  /usr/grep
and executes that instead. It's possible if you try to run a command that does not exist, it may
cache the it doesn't exist.

If that happens, try running this to fix it:
Code: [Select]
hash -rOpening a new terminal to work in should fix it too.

Quote
... Please mark as solved
Done.

Subject lines are limited to ~80 characters, so I had to modify yours so  [Solved]  would fit.

aus9

  • Guest
Rich

sorry I did not obey normal process and test after full reboot. As you can guess, its a script so I did not think that was necessary.
sorry for the noise.

but at least I remembered how to use LIST function in my build scripts thanks to you.

cheers