Первая директория в sys.path
🔸 Когда вы запускаете Python-интерпретатор в интерактивном режиме, в системные пути (sys.path) в самое начало добавляется текущая рабочая директория
>>> for path in sys.path:
... print(f'"{path}"')
""
"/usr/lib/python37.zip"
"/usr/lib/python3.7"
...
Первая строка пустая, что и означает текущую рабочую директорию.
🔸 Если вы запускаете интерпретатор передавая скрипт как аргумент, то история получается иная. На первом месте будет директория в которой располагается скрипт. А текущая рабочая директория игнорируется.
Пишем скрипт с таким содержанием:
# script.py
import sys
for path in sys.path:
print(f'"{path}"')
Запускаем
python3 /home/user/dev/script.py
Получаем
"/home/user/dev"
"/usr/lib/python37.zip"
"/usr/lib/python3.7"
...
🔸 Если вы запускаете скрипт по имени модуля то на первом месте будет домашняя директория текущего юзера
python3 -m script
"/home/user"
"/usr/lib/python37.zip"
"/usr/lib/python3.7"
...
Скрипт должен быть доступен для импорта
На что это влияет?
На видимость модулей для импорта. Если вы ждёте, что, запустив скрипт по пути, сможете импортировать модули из текущей рабочей директории, то вы ошибаетесь. Придётся добавлять путь os.getcwd() в sys.path самостоятельно или заранее объявлять переменную PYTHONPATH.
#basic
👆 Propheta living up to its name yet again 🔮
#SPKUSDT reached 9th TP!
Signal from our VIP CLUB channel!
Feels good to be a Propheta VIP, man... 🏖ACCESS TO MANUAL TRADING for 70usdt/month
👉 We will keep posting about how we earn money. Will you keep watching how someone else does it, or start earning yourself? Subscribe using our telegram bot: t.me/ProphetaAdmin_bot
Register and get bonuses up to $6,000
Binance | OKX | ByBit👈🏻click!
#trading#autotrading#bitcoin
👆 Propheta living up to its name yet again 🔮
#SPKUSDT has just reached 9th TP in the VIP CLUB channel!!!👍
$432 in profits with a 5% entry and a $1000 deposit!
ACCESS TO MANUAL TRADING for 70usdt/month
👉 Get dozens of signals like these daily!
Subscribe now >>> t.me/ProphetaAdmin_bot
Register and get bonuses up to $6,000
Binance | OKX | ByBit👈🏻click!
#trading#buyeth#CryptoSignal
👆 Propheta living up to its name yet again 🔮
#SPKUSDT has achieved 9th TP in 14 hours in our VIP HTL channel!
You could've earned $304 with a 5% entry and a $1000 deposit!
Feels good to be a Propheta VIP, man... 🏖ACCESS TO MANUAL TRADING for 70usdt/month
💰Turn data into gains with Propheta AI Analyzer: deep AI analysis spots trends with surgical precision, tweaks in seconds to your goals, and pair hunting pumps your trading to the next level — this is the evolution of the game! GET THE ACCESS
Register and get bonuses up to $6,000
Binance | OKX | ByBit👈🏻click!
#AItrading#cryptoexchange#bitcoinnews
👀 Well, would you look at that! 👆
#SPKUSDT reached 9th TP in under 58 minutes!
Signal from our VIP HTL channel!
Easy $303 with a 5% entry and a $1000 deposit!
ACCESS TO MANUAL TRADING for 70usdt/month
👉 Looking at those reports and can't believe what you're seing?
Go to our reports channel and audit us! @propheta_reports
Register and get bonuses up to $6,000
Binance | OKX | ByBit👈🏻click!
#cryptocurrency#tradingindicator#bitcoinnews
#SPK did 114% massive rally by breaking out from the bottom accumulation zone along with #Upbit SPOT listing!! Congrats traders who bought on time!!
$SPK #SPKUSDT
https://x.com/CryptoBull_360/status/2046058078567845980?s=20