Тёмный

python: os.exec* vs subprocess (intermediate) anthony explains  

anthonywritescode
Подписаться 39 тыс.
Просмотров 8 тыс.
50% 1

today I talk about the difference between the os.exec* functions (execvp, execvpe, etc.) and the subprocess functions and why I use a particular one and why exec is HORRIBLY BROKEN on windows
- don't use os.system: • don't use os.system! ...
- watch: • repeatedly checking co...
- pstree: • useful commands: `pstr...
playlist: • anthony explains
==========
twitch: / anthonywritescode
dicsord: / discord
twitter: / codewithanthony
github: github.com/asottile
stream github: github.com/anthonywritescode
I won't ask for subscriptions / likes / comments in videos but it really helps the channel. If you have any suggestions or things you'd like to see please comment below!

Наука

Опубликовано:

 

30 ноя 2020

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 20   
@rednafi
@rednafi 3 года назад
This snippet style videos regarding a specific feature of the language are amazing 🔥
@rednafi
@rednafi 3 года назад
@Jaime Armani How is that relevant here? Dafaq is wrong with people these days.
@ianchui
@ianchui 3 года назад
I've really liked this and the last video (the os.system one). I understand processes a lot more now, know about shell injections, about child processes. Got me curious and so I went out and learned about forking. Super cool stuff >:)
@ianchui
@ianchui 3 года назад
understanding the sh is just a program that tries to interpret text as commands and just runs programs as sub processes was just *mind blown* it makes so much sense
@anthonywritescode
@anthonywritescode 3 года назад
one project that's often done in college operating system courses is to implement your own shell -- can be kinda fun too!
@talalkalai8748
@talalkalai8748 Год назад
Can u explain the under the hood diff btwn "subprocess.run([python , main.py]) vs multiprocessing.Process(target=func)" ? - Do both fork to a python child proc ?
@anthonywritescode
@anthonywritescode Год назад
the latter is intended to be similar to the threading API. the former is always going to start with an effectively unshared memory due to fork+exec on platforms that support it. the latter can use shared memory through the multiprocessing primitives. neither are guaranteed to use fork
@adwaithrajesh596
@adwaithrajesh596 2 года назад
How can I use execvp with built-in commands. They don't "seem" to have a file name.
@anthonywritescode
@anthonywritescode 2 года назад
what do you mean by "built-in commands"?
@adwaithrajesh596
@adwaithrajesh596 2 года назад
@@anthonywritescode like sourse cd
@anthonywritescode
@anthonywritescode 2 года назад
those are bash builtins, so you'd have to run bash
@anthonywritescode
@anthonywritescode 2 года назад
but for example, `source` doesn't make sense to "run" it's for modifying a bash environment. cd doesn't make sense to run either, you'd just use `cwd=...`
Далее
меня не было 9 дней
12:48
Просмотров 1,7 млн
Python Call a System Command!
10:14
Просмотров 24 тыс.
Unlocking your CPU cores in Python (multiprocessing)
12:16
FANG Interview Question | Process vs Thread
3:51
Просмотров 290 тыс.
Acer Predator Тараканьи Бега!
1:00
Просмотров 459 тыс.