Services génériques du système d'exploitation¶
Les modules documentés dans ce chapitre fournissent des interfaces vers des fonctionnalités communes à la grande majorité des systèmes d'exploitation, telles que les fichiers et l'horloge. Bien que ces interfaces soient classiquement calquées sur les interfaces Unix ou C, elles sont aussi disponibles sur la plupart des autres systèmes. En voici un aperçu :
os--- Miscellaneous operating system interfaceserrorname- Noms de fichiers, arguments en ligne de commande, et variables d'environnement
- Python UTF-8 Mode
- Paramètres de processus
ctermid()environenvironbfsencode()fsdecode()fspath()PathLikegetenv()getenvb()get_exec_path()getegid()geteuid()getgid()getgrouplist()getgroups()getlogin()getpgid()getpgrp()getpid()getppid()getpriority()PRIO_PROCESSPRIO_PGRPPRIO_USERPRIO_DARWIN_THREADPRIO_DARWIN_PROCESSPRIO_DARWIN_BGPRIO_DARWIN_NONUIgetresuid()getresgid()getuid()initgroups()putenv()setegid()seteuid()setgid()setgroups()setns()setpgrp()setpgid()setpriority()setregid()setresgid()setresuid()setreuid()getsid()setsid()setuid()strerror()supports_bytes_environumask()uname()unsetenv()unshare()CLONE_FILESCLONE_FSCLONE_NEWCGROUPCLONE_NEWIPCCLONE_NEWNETCLONE_NEWNSCLONE_NEWPIDCLONE_NEWTIMECLONE_NEWUSERCLONE_NEWUTSCLONE_SIGHANDCLONE_SYSVSEMCLONE_THREADCLONE_VM
- Création de fichiers objets
- Opérations sur les descripteurs de fichiers
close()closerange()copy_file_range()device_encoding()dup()dup2()fchmod()fchown()fdatasync()fpathconf()fstat()fstatvfs()fsync()ftruncate()get_blocking()grantpt()isatty()lockf()F_LOCKF_TLOCKF_ULOCKF_TESTlogin_tty()lseek()SEEK_SETSEEK_CURSEEK_ENDSEEK_HOLESEEK_DATAopen()O_RDONLYO_WRONLYO_RDWRO_APPENDO_CREATO_EXCLO_TRUNCO_DSYNCO_RSYNCO_SYNCO_NDELAYO_NONBLOCKO_NOCTTYO_CLOEXECO_BINARYO_NOINHERITO_SHORT_LIVEDO_TEMPORARYO_RANDOMO_SEQUENTIALO_TEXTO_EVTONLYO_FSYNCO_SYMLINKO_NOFOLLOW_ANYO_ASYNCO_DIRECTO_DIRECTORYO_NOFOLLOWO_NOATIMEO_PATHO_TMPFILEO_SHLOCKO_EXLOCKopenpty()pipe()pipe2()posix_fallocate()posix_fadvise()POSIX_FADV_NORMALPOSIX_FADV_SEQUENTIALPOSIX_FADV_RANDOMPOSIX_FADV_NOREUSEPOSIX_FADV_WILLNEEDPOSIX_FADV_DONTNEEDpread()posix_openpt()preadv()RWF_NOWAITRWF_HIPRIptsname()pwrite()pwritev()RWF_DSYNCRWF_SYNCRWF_APPENDread()sendfile()SF_NODISKIOSF_MNOWAITSF_SYNCSF_NOCACHEset_blocking()splice()SPLICE_F_MOVESPLICE_F_NONBLOCKSPLICE_F_MOREreadv()tcgetpgrp()tcsetpgrp()ttyname()unlockpt()write()writev()- Demander la taille d'un terminal
- Héritage de descripteurs de fichiers
- Fichiers et répertoires
access()F_OKR_OKW_OKX_OKchdir()chflags()chmod()chown()chroot()fchdir()getcwd()getcwdb()lchflags()lchmod()lchown()link()listdir()listdrives()listmounts()listvolumes()lstat()mkdir()makedirs()mkfifo()mknod()major()minor()makedev()pathconf()pathconf_namesreadlink()remove()removedirs()rename()renames()replace()rmdir()scandir()DirEntrystat()stat_resultstatvfs()supports_dir_fdsupports_effective_idssupports_fdsupports_follow_symlinkssymlink()sync()truncate()unlink()utime()walk()fwalk()memfd_create()MFD_CLOEXECMFD_ALLOW_SEALINGMFD_HUGETLBMFD_HUGE_SHIFTMFD_HUGE_MASKMFD_HUGE_64KBMFD_HUGE_512KBMFD_HUGE_1MBMFD_HUGE_2MBMFD_HUGE_8MBMFD_HUGE_16MBMFD_HUGE_32MBMFD_HUGE_256MBMFD_HUGE_512MBMFD_HUGE_1GBMFD_HUGE_2GBMFD_HUGE_16GBeventfd()eventfd_read()eventfd_write()EFD_CLOEXECEFD_NONBLOCKEFD_SEMAPHORE- Timer File Descriptors
- Attributs étendus pour Linux
- Gestion des processus
abort()add_dll_directory()execl()execle()execlp()execlpe()execv()execve()execvp()execvpe()_exit()EX_OKEX_USAGEEX_DATAERREX_NOINPUTEX_NOUSEREX_NOHOSTEX_UNAVAILABLEEX_SOFTWAREEX_OSERREX_OSFILEEX_CANTCREATEX_IOERREX_TEMPFAILEX_PROTOCOLEX_NOPERMEX_CONFIGEX_NOTFOUNDfork()forkpty()kill()killpg()nice()pidfd_open()plock()popen()posix_spawn()posix_spawnp()register_at_fork()spawnl()spawnle()spawnlp()spawnlpe()spawnv()spawnve()spawnvp()spawnvpe()P_NOWAITP_NOWAITOP_WAITP_DETACHP_OVERLAYstartfile()system()times()wait()waitid()waitpid()wait3()wait4()P_PIDP_PGIDP_ALLP_PIDFDWCONTINUEDWEXITEDWSTOPPEDWUNTRACEDWNOHANGWNOWAITCLD_EXITEDCLD_KILLEDCLD_DUMPEDCLD_TRAPPEDCLD_STOPPEDCLD_CONTINUEDwaitstatus_to_exitcode()WCOREDUMP()WIFCONTINUED()WIFSTOPPED()WIFSIGNALED()WIFEXITED()WEXITSTATUS()WSTOPSIG()WTERMSIG()
- Interface pour l'ordonnanceur
SCHED_OTHERSCHED_BATCHSCHED_IDLESCHED_SPORADICSCHED_FIFOSCHED_RRSCHED_RESET_ON_FORKsched_paramsched_get_priority_min()sched_get_priority_max()sched_setscheduler()sched_getscheduler()sched_setparam()sched_getparam()sched_rr_get_interval()sched_yield()sched_setaffinity()sched_getaffinity()
- Diverses informations sur le système
- Nombres aléatoires
io--- Core tools for working with streamstime--- Time access and conversions- Fonctions
asctime()pthread_getcpuclockid()clock_getres()clock_gettime()clock_gettime_ns()clock_settime()clock_settime_ns()ctime()get_clock_info()gmtime()localtime()mktime()monotonic()monotonic_ns()perf_counter()perf_counter_ns()process_time()process_time_ns()sleep()strftime()strptime()struct_timetime()time_ns()thread_time()thread_time_ns()tzset()
- Constantes d’identification d’horloge
- Constantes de fuseau horaire
- Fonctions
argparse--- Parser for command-line options, arguments and subcommands- Objets
ArgumentParserArgumentParser- Le paramètre prog
- Le paramètre usage
- Le paramètre description
- Le paramètre epilog
- Le paramètre parents
- Le paramètre formatter_class
- Le paramètre prefix_chars
- Le paramètre fromfile_prefix_chars
- Le paramètre argument_default
- Le paramètre allow_abbrev
- Le paramètre conflict_handler
- Le paramètre add_help
- Le paramètre exit_on_error
- La méthode add_argument()
- La méthode parse_args()
- Autres outils
- Exceptions
ArgumentErrorArgumentTypeError- Tutoriel argparse
- Mettre à jour du code
optparse
- Objets
logging--- Logging facility for Pythonlogging.config--- Logging configurationlogging.handlers--- Logging handlers- Gestionnaire à flux — StreamHandler
- Gestionnaire à fichier — FileHandler
- Gestionnaire à puits sans fond — NullHandler
- Gestionnaire à fichier avec surveillance — WatchedFileHandler
- Base des gestionnaires à roulement — BaseRotatingHandler
- Gestionnaire à roulement de fichiers — RotatingFileHandler
- Gestionnaire à roulement de fichiers périodique — TimedRotatingFileHandler
- Gestionnaire à connecteur — SocketHandler
- DatagramHandler
- SysLogHandler
- NTEventLogHandler
- SMTPHandler
- MemoryHandler
- HTTPHandler
- QueueHandler
- QueueListener
getpass--- Portable password inputcurses--- Terminal handling for character-cell displays- Fonctions
errorbaudrate()beep()can_change_color()cbreak()color_content()color_pair()curs_set()def_prog_mode()def_shell_mode()delay_output()doupdate()echo()endwin()erasechar()filter()flash()flushinp()getmouse()getsyx()getwin()has_colors()has_extended_color_support()has_ic()has_il()has_key()halfdelay()init_color()init_pair()initscr()is_term_resized()isendwin()keyname()killchar()longname()meta()mouseinterval()mousemask()napms()newpad()newwin()nl()nocbreak()noecho()nonl()noqiflush()noraw()pair_content()pair_number()putp()qiflush()raw()reset_prog_mode()reset_shell_mode()resetty()resize_term()resizeterm()savetty()get_escdelay()set_escdelay()get_tabsize()set_tabsize()setsyx()setupterm()start_color()termattrs()termname()tigetflag()tigetnum()tigetstr()tparm()typeahead()unctrl()ungetch()update_lines_cols()unget_wch()ungetmouse()use_env()use_default_colors()wrapper()
- Window Objects
addch()addnstr()addstr()attroff()attron()attrset()bkgd()bkgdset()border()box()chgat()clear()clearok()clrtobot()clrtoeol()cursyncup()delch()deleteln()derwin()echochar()enclose()encodingerase()getbegyx()getbkgd()getch()get_wch()getkey()getmaxyx()getparyx()getstr()getyx()hline()idcok()idlok()immedok()inch()insch()insdelln()insertln()insnstr()insstr()instr()is_linetouched()is_wintouched()keypad()leaveok()move()mvderwin()mvwin()nodelay()notimeout()noutrefresh()overlay()overwrite()putwin()redrawln()redrawwin()refresh()resize()scroll()scrollok()setscrreg()standend()standout()subpad()subwin()syncdown()syncok()syncup()timeout()touchline()touchwin()untouchwin()vline()
- Constantes
ERROKversion__version__ncurses_versionCOLORSCOLOR_PAIRSCOLSLINESA_ALTCHARSETA_BLINKA_BOLDA_DIMA_INVISA_ITALICA_NORMALA_PROTECTA_REVERSEA_STANDOUTA_UNDERLINEA_HORIZONTALA_LEFTA_LOWA_RIGHTA_TOPA_VERTICALA_ATTRIBUTESA_CHARTEXTA_COLORKEY_MINKEY_BREAKKEY_DOWNKEY_UPKEY_LEFTKEY_RIGHTKEY_HOMEKEY_BACKSPACEKEY_F0KEY_FnKEY_DLKEY_ILKEY_DCKEY_ICKEY_EICKEY_CLEARKEY_EOSKEY_EOLKEY_SFKEY_SRKEY_NPAGEKEY_PPAGEKEY_STABKEY_CTABKEY_CATABKEY_ENTERKEY_SRESETKEY_RESETKEY_PRINTKEY_LLKEY_A1KEY_A3KEY_B2KEY_C1KEY_C3KEY_BTABKEY_BEGKEY_CANCELKEY_CLOSEKEY_COMMANDKEY_COPYKEY_CREATEKEY_ENDKEY_EXITKEY_FINDKEY_HELPKEY_MARKKEY_MESSAGEKEY_MOVEKEY_NEXTKEY_OPENKEY_OPTIONSKEY_PREVIOUSKEY_REDOKEY_REFERENCEKEY_REFRESHKEY_REPLACEKEY_RESTARTKEY_RESUMEKEY_SAVEKEY_SBEGKEY_SCANCELKEY_SCOMMANDKEY_SCOPYKEY_SCREATEKEY_SDCKEY_SDLKEY_SELECTKEY_SENDKEY_SEOLKEY_SEXITKEY_SFINDKEY_SHELPKEY_SHOMEKEY_SICKEY_SLEFTKEY_SMESSAGEKEY_SMOVEKEY_SNEXTKEY_SOPTIONSKEY_SPREVIOUSKEY_SPRINTKEY_SREDOKEY_SREPLACEKEY_SRIGHTKEY_SRSUMEKEY_SSAVEKEY_SSUSPENDKEY_SUNDOKEY_SUSPENDKEY_UNDOKEY_MOUSEKEY_RESIZEKEY_MAXACS_BBSSACS_BLOCKACS_BOARDACS_BSBSACS_BSSBACS_BSSSACS_BTEEACS_BULLETACS_CKBOARDACS_DARROWACS_DEGREEACS_DIAMONDACS_GEQUALACS_HLINEACS_LANTERNACS_LARROWACS_LEQUALACS_LLCORNERACS_LRCORNERACS_LTEEACS_NEQUALACS_PIACS_PLMINUSACS_PLUSACS_RARROWACS_RTEEACS_S1ACS_S3ACS_S7ACS_S9ACS_SBBSACS_SBSBACS_SBSSACS_SSBBACS_SSBSACS_SSSBACS_SSSSACS_STERLINGACS_TTEEACS_UARROWACS_ULCORNERACS_URCORNERACS_VLINEBUTTONn_PRESSEDBUTTONn_RELEASEDBUTTONn_CLICKEDBUTTONn_DOUBLE_CLICKEDBUTTONn_TRIPLE_CLICKEDBUTTON_SHIFTBUTTON_CTRLBUTTON_ALTCOLOR_BLACKCOLOR_BLUECOLOR_CYANCOLOR_GREENCOLOR_MAGENTACOLOR_REDCOLOR_WHITECOLOR_YELLOW
- Fonctions
curses.textpad--- Text input widget for curses programscurses.ascii--- Utilities for ASCII charactersNULSOHSTXETXEOTENQACKBELBSTABHTLFNLVTFFCRSOSIDLEDC1DC2DC3DC4NAKSYNETBCANEMSUBESCFSGSRSUSSPDELisalnum()isalpha()isascii()isblank()iscntrl()isdigit()isgraph()islower()isprint()ispunct()isspace()isupper()isxdigit()isctrl()ismeta()ascii()ctrl()alt()unctrl()controlnames
curses.panel--- A panel stack extension for cursesplatform--- Access to underlying platform's identifying dataerrno--- Standard errno system symbolserrorcodeEPERMENOENTESRCHEINTREIOENXIOE2BIGENOEXECEBADFECHILDEAGAINENOMEMEACCESEFAULTENOTBLKEBUSYEEXISTEXDEVENODEVENOTDIREISDIREINVALENFILEEMFILEENOTTYETXTBSYEFBIGENOSPCESPIPEEROFSEMLINKEPIPEEDOMERANGEEDEADLKENAMETOOLONGENOLCKENOSYSENOTEMPTYELOOPEWOULDBLOCKENOMSGEIDRMECHRNGEL2NSYNCEL3HLTEL3RSTELNRNGEUNATCHENOCSIEL2HLTEBADEEBADREXFULLENOANOEBADRQCEBADSLTEDEADLOCKEBFONTENOSTRENODATAETIMEENOSRENONETENOPKGEREMOTEENOLINKEADVESRMNTECOMMEPROTOEMULTIHOPEDOTDOTEBADMSGEOVERFLOWENOTUNIQEBADFDEREMCHGELIBACCELIBBADELIBSCNELIBMAXELIBEXECEILSEQERESTARTESTRPIPEEUSERSENOTSOCKEDESTADDRREQEMSGSIZEEPROTOTYPEENOPROTOOPTEPROTONOSUPPORTESOCKTNOSUPPORTEOPNOTSUPPENOTSUPEPFNOSUPPORTEAFNOSUPPORTEADDRINUSEEADDRNOTAVAILENETDOWNENETUNREACHENETRESETECONNABORTEDECONNRESETENOBUFSEISCONNENOTCONNESHUTDOWNETOOMANYREFSETIMEDOUTECONNREFUSEDEHOSTDOWNEHOSTUNREACHEALREADYEINPROGRESSESTALEEUCLEANENOTNAMENAVAILEISNAMEREMOTEIOEDQUOTEQFULLENOTCAPABLEECANCELEDEOWNERDEADENOTRECOVERABLE
ctypes--- A foreign function library for Python- Didacticiel de ctypes
- Chargement des DLL
- Accès aux fonctions des DLL chargées
- Appel de fonctions
- Types de données de base
- Appel de fonctions, suite
- Calling variadic functions
- Appel de fonctions avec des types de données personnalisés
- Définition du type des arguments nécessaires (prototypes de fonction)
- Types de sortie
- Passage de pointeurs (passage de paramètres par référence)
- Structures et unions
- Alignement et boutisme des structures et des unions
- Champs de bits dans les structures et les unions
- Tableaux
- Pointeurs
- Conversions de type
- Types incomplets
- Fonctions de rappel
- Accès aux variables exportées depuis une DLL
- Pièges
- Types de données à taille flottante
- Référence du module
- Recherche de bibliothèques partagées
- Chargement des bibliothèques partagées
- Fonctions externes
- Prototypes de fonction
- Fonctions utilitaires
addressof()alignment()byref()cast()create_string_buffer()create_unicode_buffer()DllCanUnloadNow()DllGetClassObject()find_library()find_msvcrt()FormatError()GetLastError()get_errno()get_last_error()memmove()memset()POINTER()pointer()resize()set_errno()set_last_error()sizeof()string_at()WinError()wstring_at()
- Types de données
- Types de données de base
- Types de données dérivés de Structure
- Tableaux et pointeurs
- Didacticiel de ctypes