[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/python/python-docs-pl/friendly-traceback/tutorial/errors.po [Back]  [Original]

# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001 Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR , YEAR.
#
# Translators:
# python-doc bot, 2025
# Maciej Olko, 2026
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Python 3.15\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-08-21 14:26+0000\n"
"PO-Revision-Date: 2025-09-16 00:02+0000\n"
"Last-Translator: Maciej Olko, 2026\n"
"Language-Team: Polish (https://app.transifex.com/python-doc/teams/5390/pl/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: pl\n"
"Plural-Forms: nplurals=4; plural=(n==1 ? 0 : (n%10>=2 && n%10=0 && n%10=5 && "
"n%10=12 && n%100>> try:\n"
"...     raise Exception('spam', 'eggs')\n"
"... except Exception as inst:\n"
"...     print(type(inst))    # the exception type\n"
"...     print(inst.args)     # arguments stored in .args\n"
"...     print(inst)          # __str__ allows args to be printed directly,\n"
"...                          # but may be overridden in exception "
"subclasses\n"
"...     x, y = inst.args     # unpack args\n"
"...     print('x =', x)\n"
"...     print('y =', y)\n"
"...\n"
"\n"
"('spam', 'eggs')\n"
"('spam', 'eggs')\n"
"x = spam\n"
"y = eggs"
msgstr ""
">>> try:\n"
"...     raise Exception('konserwa', 'jajka')\n"
"... except Exception as inst:\n"
"...     print(type(inst))    # typ wyjtku\n"
"...     print(inst.args)     # argumenty przechowywane w .args\n"
"...     print(inst)          # metoda __str__ pozwala na wypisanie args "
"bezporednio,\n"
"...                          # ale jej definicja moe by nadpisana w "
"klasach dziedziczcych\n"
"...     x, y = inst.args     # rozpakowanie argumentw\n"
"...     print('x =', x)\n"
"...     print('y =', y)\n"
"...\n"
"\n"
"('konserwa', 'jajka')\n"
"('konserwa', 'jajka')\n"
"x = konserwa\n"
"y = jajka"

msgid ""
"The exception's :meth:`~object.__str__` output is printed as the last part "
"('detail') of the message for unhandled exceptions."
msgstr ""
"Dane wyjciowe metody :meth:`~object.__str__` wyjtku s drukowane jako "
"ostatnia cz ('szczegy') komunikatu dla nieobsuonych wyjtkw."

msgid ""
":exc:`BaseException` is the common base class of all exceptions. One of its "
"subclasses, :exc:`Exception`, is the base class of all the non-fatal "
"exceptions. Exceptions which are not subclasses of :exc:`Exception` are not "
"typically handled, because they are used to indicate that the program should "
"terminate. They include :exc:`SystemExit` which is raised by :meth:`sys."
"exit` and :exc:`KeyboardInterrupt` which is raised when a user wishes to "
"interrupt the program."
msgstr ""
":exc:`BaseException` jest wspln klas bazow wszystkich wyjtkw. Jedna z "
"jej podklas, :exc:`Exception`, jest klas bazow wszystkich nie-fatalnych "
"wyjtkw. Wyjtki, ktre nie s podklasami :exc:`Exception` nie s zazwyczaj "
"obsugiwane, poniewa s uywane do wskazania, e program powinien si "
"zakoczy. Obejmuj one :exc:`SystemExit`, ktry jest rzucany przez :meth:"
"`sys.exit` i :exc:`KeyboardInterrupt`, ktre s rzucane, gdy uytkownik chce "
"przerwa program."

msgid ""
":exc:`Exception` can be used as a wildcard that catches (almost) everything. "
"However, it is good practice to be as specific as possible with the types of "
"exceptions that we intend to handle, and to allow any unexpected exceptions "
"to propagate on."
msgstr ""
":exc:`Exception` moe by uywany jako symbol wieloznaczny, ktry "
"przechwytuje (prawie) wszystko. Dobr praktyk jest jednak jak "
"najdokadniejsze okrelenie typw wyjtkw, ktre zamierzamy obsugiwa, i "
"umoliwienie propagacji wszelkim nieoczekiwanym wyjtkom."

msgid ""
"The most common pattern for handling :exc:`Exception` is to print or log the "
"exception and then re-raise it (allowing a caller to handle the exception as "
"well)::"
msgstr ""
"Najczstszym wzorcem obsugi :exc:`Exception` jest drukowanie lub "
"umieszczenie wyjtku w logach, a nastpnie ponowne rzucenie go (umoliwiajc "
"rwnie obsug wyjtku funkcji, w ktrej znajduje si wywoanie)::"

msgid ""
"import sys\n"
"\n"
"try:\n"
"    f = open('myfile.txt')\n"
"    s = f.readline()\n"
"    i = int(s.strip())\n"
"except OSError as err:\n"
"    print(\"OS error:\", err)\n"
"except ValueError:\n"
"    print(\"Could not convert data to an integer.\")\n"
"except Exception as err:\n"
"    print(f\"Unexpected {err=}, {type(err)=}\")\n"
"    raise"
msgstr ""
"import sys\n"
"\n"
"try:\n"
"    f = open('moj_plik.txt')\n"
"    s = f.readline()\n"
"    i = int(s.strip())\n"
"except OSError as err:\n"
"    print(\"Bd OS:\", err)\n"
"except ValueError:\n"
"    print(\"Nie udao si przekonwertowa danych na liczb cakowit.\")\n"
"except Exception as err:\n"
"    print(f\"Nieoczekiwany {err=}, {type(err)=}\")\n"
"    raise"

msgid ""
"The :keyword:`try` ... :keyword:`except` statement has an optional *else "
"clause*, which, when present, must follow all *except clauses*.  It is "
"useful for code that must be executed if the *try clause* does not raise an "
"exception. For example::"
msgstr ""
"Instrukcja :keyword:`try`  :keyword:`except` posiada opcjonaln *klauzul "
"else*, ktra, gdy jest obecna, musi nastpowa po wszystkich *klauzulach "
"except*. Jest to przydatne w przypadku kodu, ktry musi zosta wykonany, "
"jeli *klauzula try* nie rzuci wyjtku. Na przykad::"

msgid ""
"for arg in sys.argv[1:]:\n"
"    try:\n"
"        f = open(arg, 'r')\n"
"    except OSError:\n"
"        print('cannot open', arg)\n"
"    else:\n"
"        print(arg, 'has', len(f.readlines()), 'lines')\n"
"        f.close()"
msgstr ""
"for arg in sys.argv[1:]:\n"
"    try:\n"
"        f = open(arg, 'r')\n"
"    except OSError:\n"
"        print('nie mog otworzy', arg)\n"
"    else:\n"
"        print(arg, 'ma', len(f.readlines()), 'linii')\n"
"        f.close()"

msgid ""
"The use of the :keyword:`!else` clause is better than adding additional code "
"to the :keyword:`try` clause because it avoids accidentally catching an "
"exception that wasn't raised by the code being protected by the :keyword:`!"
"try` ... :keyword:`!except` statement."
msgstr ""
"Uycie klauzuli :keyword:`!else` jest lepsze ni dodanie dodatkowego kodu do "
"klauzuli :keyword:`try`, poniewa pozwala unikn przypadkowego wychwycenia "
"wyjtku, ktry nie zosta rzucony przez kod chroniony instrukcj :keyword:`!"
"try` :keyword:`!except`."

msgid ""
"Exception handlers do not handle only exceptions that occur immediately in "
"the *try clause*, but also those that occur inside functions that are called "
"(even indirectly) in the *try clause*. For example::"
msgstr ""
"Instrukcja `try`  `catch` nie obsuguje tylko wyjtkw, ktre wystpuj "
"bezporednio w *klauzuli try*, ale take te, ktre wystpuj wewntrz "
"funkcji, ktre s wywoywane (nawet porednio) w *klauzuli try*. Na "
"przykad::"

msgid ""
">>> def this_fails():\n"
"...     x = 1/0\n"
"...\n"
">>> try:\n"
"...     this_fails()\n"
"... except ZeroDivisionError as err:\n"
"...     print('Handling run-time error:', err)\n"
"...\n"
"Handling run-time error: division by zero"
msgstr ""
">>> def this_fails():\n"
"...     x = 1/0\n"
"...\n"
">>> try:\n"
"...     this_fails()\n"
"... except ZeroDivisionError as err:\n"
"...     print('Bd w czasie wykonania:', err)\n"
"...\n"
"Bd w czasie wykonania: division by zero"

msgid "Raising Exceptions"
msgstr "Rzucanie wyjtkw"

msgid ""
"The :keyword:`raise` statement allows the programmer to force a specified "
"exception to occur. For example::"
msgstr ""
"Instrukcja :keyword:`raise` pozwala programicie wymusi wystpienie "
"danego wyjtku. Na przykad::"

msgid ""
">>> raise NameError('HiThere')\n"
"Traceback (most recent call last):\n"
"  File \"\", line 1, in \n"
"    raise NameError('HiThere')\n"
"NameError: HiThere"
msgstr ""
">>> raise NameError('CzeiCzoem')\n"
"Traceback (most recent call last):\n"
"  File \"\", line 1, in \n"
"    raise NameError('CzeiCzoem')\n"
"NameError: CzeiCzoem"

msgid ""
"The sole argument to :keyword:`raise` indicates the exception to be raised. "
"This must be either an exception instance or an exception class (a class "
"that derives from :class:`BaseException`, such as :exc:`Exception` or one of "
"its subclasses).  If an exception class is passed, it will be implicitly "
"instantiated by calling its constructor with no arguments::"
msgstr ""
"Jedyny argument do :keyword:`raise` wskazuje wyjtek, ktry ma by rzucony. "
"Musi to by albo instancja wyjtku, albo klasa wyjtku (klasa dziedziczca "
"z :class:`BaseException`, taka jak :exc:`Exception` lub jedna z jej "
"podklas). Jeli przekazana zostanie klasa wyjtku, zostanie ona niejawnie "
"zainicjowana przez wywoanie jej konstruktora bez argumentw::"

msgid "raise ValueError  # shorthand for 'raise ValueError()'"
msgstr "raise ValueError  # skrt dla 'raise ValueError()'"

msgid ""
"If you need to determine whether an exception was raised but don't intend to "
"handle it, a simpler form of the :keyword:`raise` statement allows you to re-"
"raise the exception::"
msgstr ""
"Jeli chcesz rozpozna, czy wyjtek zosta rzucony, ale nie zamierzasz go "
"obsugiwa, prostsza forma instrukcji :keyword:`raise` pozwala na ponowne "
"rzucenie wyjtku::"

msgid ""
">>> try:\n"
"...     raise NameError('HiThere')\n"
"... except NameError:\n"
"...     print('An exception flew by!')\n"
"...     raise\n"
"...\n"
"An exception flew by!\n"
"Traceback (most recent call last):\n"
"  File \"\", line 2, in \n"
"    raise NameError('HiThere')\n"
"NameError: HiThere"
msgstr ""
">>> try:\n"
"...     raise NameError('CzeiCzoem')\n"
"... except NameError:\n"
"...     print('Przelecia wyjtek!')\n"
"...     raise\n"
"...\n"
"Przelecia wyjtek!\n"
"Traceback (most recent call last):\n"
"  File \"\", line 2, in \n"
"    raise NameError('CzeiCzoem')\n"
"NameError: CzeiCzoem"

msgid "Exception Chaining"
msgstr "acuch wyjtkw"

msgid ""
"If an unhandled exception occurs inside an :keyword:`except` section, it "
"will have the exception being handled attached to it and included in the "
"error message::"
msgstr ""
"Jeli nieobsuony wyjtek wystpi wewntrz sekcji :keyword:`except`, "
"zostanie do niego doczony obsugiwany wyjtek i uwzgldniony w komunikacie "
"o bdzie::"

msgid ""
">>> try:\n"
"...     open(\"database.sqlite\")\n"
"... except OSError:\n"
"...     raise RuntimeError(\"unable to handle error\")\n"
"...\n"
"Traceback (most recent call last):\n"
"  File \"\", line 2, in \n"
"    open(\"database.sqlite\")\n"
"    ~~~~^^^^^^^^^^^^^^^^^^^\n"
"FileNotFoundError: [Errno 2] No such file or directory: 'database.sqlite'\n"
"\n"
"During handling of the above exception, another exception occurred:\n"
"\n"
"Traceback (most recent call last):\n"
"  File \"\", line 4, in \n"
"    raise RuntimeError(\"unable to handle error\")\n"
"RuntimeError: unable to handle error"
msgstr ""
">>> try:\n"
"...     open(\"bazadanych.sqlite\")\n"
"... except OSError:\n"
"...     raise RuntimeError(\"nie da si obsuy bdu\")\n"
"...\n"
"Traceback (most recent call last):\n"
"  File \"\", line 2, in \n"
"    open(\"bazadanych.sqlite\")\n"
"    ~~~~^^^^^^^^^^^^^^^^^^^^^\n"
"FileNotFoundError: [Errno 2] No such file or directory: 'bazadanych.sqlite'\n"
"\n"
"During handling of the above exception, another exception occurred:\n"
"\n"
"Traceback (most recent call last):\n"
"  File \"\", line 4, in \n"
"    raise RuntimeError(\"nie da si obsuy bdu\")\n"
"RuntimeError: nie da si obsuy bdu"

msgid ""
"To indicate that an exception is a direct consequence of another, the :"
"keyword:`raise` statement allows an optional :keyword:`from` clause::"
msgstr ""
"Aby wskaza, e wyjtek jest bezporedni konsekwencj innego, instrukcja :"
"keyword:`raise` dopuszcza opcjonaln klauzul :keyword:`from`::"

msgid ""
"# exc must be exception instance or None.\n"
"raise RuntimeError from exc"
msgstr ""
"# exc musi by instancj klasy Exception albo mie warto None\n"
"raise RuntimeError from exc"

msgid "This can be useful when you are transforming exceptions. For example::"
msgstr "Moe to by przydatne podczas przeksztacania wyjtkw. Na przykad::"

msgid ""
">>> def func():\n"
"...     raise ConnectionError\n"
"...\n"
">>> try:\n"
"...     func()\n"
"... except ConnectionError as exc:\n"
"...     raise RuntimeError('Failed to open database') from exc\n"
"...\n"
"Traceback (most recent call last):\n"
"  File \"\", line 2, in \n"
"    func()\n"
"    ~~~~^^\n"
"  File \"\", line 2, in func\n"
"ConnectionError\n"
"\n"
"The above exception was the direct cause of the following exception:\n"
"\n"
"Traceback (most recent call last):\n"
"  File \"\", line 4, in \n"
"    raise RuntimeError('Failed to open database') from exc\n"
"RuntimeError: Failed to open database"
msgstr ""
">>> def func():\n"
"...     raise ConnectionError\n"
"...\n"
">>> try:\n"
"...     func()\n"
"... except ConnectionError as exc:\n"
"...     raise RuntimeError('Nie udao si otworzy bazy danych') from exc\n"
"...\n"
"Traceback (most recent call last):\n"
"  File \"\", line 2, in \n"
"    func()\n"
"    ~~~~^^\n"
"  File \"\", line 2, in func\n"
"ConnectionError\n"
"\n"
"The above exception was the direct cause of the following exception:\n"
"\n"
"Traceback (most recent call last):\n"
"  File \"\", line 4, in \n"
"    raise RuntimeError('Nie udao si otworzy bazy danych') from exc\n"
"RuntimeError: Nie udao si otworzy bazy danych"

msgid ""
"It also allows disabling automatic exception chaining using the ``from "
"None`` idiom::"
msgstr ""
"Umoliwia rwnie wyczenie automatycznego czenia wyjtkw przy uyciu "
"idiomu ``from None``::"

msgid ""
">>> try:\n"
"...     open('database.sqlite')\n"
"... except OSError:\n"
"...     raise RuntimeError from None\n"
"...\n"
"Traceback (most recent call last):\n"
"  File \"\", line 4, in \n"
"    raise RuntimeError from None\n"
"RuntimeError"
msgstr ""
">>> try:\n"
"...     open('bazadanych.sqlite')\n"
"... except OSError:\n"
"...     raise RuntimeError from None\n"
"...\n"
"Traceback (most recent call last):\n"
"  File \"\", line 4, in \n"
"    raise RuntimeError from None\n"
"RuntimeError"

msgid ""
"For more information about chaining mechanics, see :ref:`bltin-exceptions`."
msgstr ""
"Wicej informacji na temat mechaniki czenia w acuchy mona znale w "
"rozdziale :ref:`bltin-exceptions`."

msgid "User-defined Exceptions"
msgstr "Wyjtki zdefiniowane przez uytkownika"

msgid ""
"Programs may name their own exceptions by creating a new exception class "
"(see :ref:`tut-classes` for more about Python classes).  Exceptions should "
"typically be derived from the :exc:`Exception` class, either directly or "
"indirectly."
msgstr ""
"Programy mog nazywa wasne wyjtki, tworzc now klas wyjtkw (wicej "
"informacji na temat klas Python mona znale w rozdziale :ref:`tut-"
"classes`). Wyjtki powinny zazwyczaj dziedziczy z klasy :exc:`Exception`, "
"bezporednio lub porednio."

msgid ""
"Exception classes can be defined which do anything any other class can do, "
"but are usually kept simple, often only offering a number of attributes that "
"allow information about the error to be extracted by handlers for the "
"exception."
msgstr ""
"Mona zdefiniowa klasy wyjtkw, ktre robi wszystko, co moe zrobi kada "
"inna klasa, ale zwykle s one proste, czsto oferujc tylko kilka atrybutw, "
"ktre pozwalaj na wyodrbnienie informacji o bdzie przez kod obsugi "
"wyjtku."

msgid ""
"Most exceptions are defined with names that end in \"Error\", similar to the "
"naming of the standard exceptions."
msgstr ""
"Wikszo wyjtkw ma nazwy koczce si na Error, podobnie jak w "
"przypadku standardowych wyjtkw."

msgid ""
"Many standard modules define their own exceptions to report errors that may "
"occur in functions they define."
msgstr ""
"Wiele standardowych moduw definiuje wasne wyjtki w celu zgaszania "
"bdw, ktre mog wystpi w zdefiniowanych w nich funkcjach."

msgid "Defining Clean-up Actions"
msgstr "Definiowanie dziaa porzdkujcych"

msgid ""
"The :keyword:`try` statement has another optional clause which is intended "
"to define clean-up actions that must be executed under all circumstances.  "
"For example::"
msgstr ""
"Instrukcja :keyword:`try` ma inn opcjonaln klauzul, ktra jest "
"przeznaczona do definiowania dziaa porzdkujcych, ktre musz by "
"wykonane w kadych okolicznociach. Na przykad::"

msgid ""
">>> try:\n"
"...     raise KeyboardInterrupt\n"
"... finally:\n"
"...     print('Goodbye, world!')\n"
"...\n"
"Goodbye, world!\n"
"Traceback (most recent call last):\n"
"  File \"\", line 2, in \n"
"    raise KeyboardInterrupt\n"
"KeyboardInterrupt"
msgstr ""
">>> try:\n"
"...     raise KeyboardInterrupt\n"
"... finally:\n"
"...     print('Do widzenia, wiecie!')\n"
"...\n"
"Do widzenia, wiecie!\n"
"Traceback (most recent call last):\n"
"  File \"\", line 2, in \n"
"    raise KeyboardInterrupt\n"
"KeyboardInterrupt"

msgid ""
"If a :keyword:`finally` clause is present, the :keyword:`!finally` clause "
"will execute as the last task before the :keyword:`try` statement completes. "
"The :keyword:`!finally` clause runs whether or not the :keyword:`!try` "
"statement produces an exception. The following points discuss more complex "
"cases when an exception occurs:"
msgstr ""
"Jeli klauzula :keyword:`finally` jest obecna, klauzula :keyword:`!finally` "
"wykona si jako ostatnie zadanie przed zakoczeniem instrukcji :keyword:"
"`try`. Klauzula :keyword:`!finally` uruchomi si niezalenie od tego, czy "
"instrukcja :keyword:`!try` spowoduje wyjtek. Ponisze punkty omawiaj "
"bardziej zoone przypadki wystpienia wyjtku:"

msgid ""
"If an exception occurs during execution of the :keyword:`!try` clause, the "
"exception may be handled by an :keyword:`except` clause. If the exception is "
"not handled by an :keyword:`!except` clause, the exception is re-raised "
"after the :keyword:`!finally` clause has been executed."
msgstr ""
"Jeli podczas wykonywania klauzuli :keyword:`!try` wystpi wyjtek, moe on "
"zosta obsuony przez klauzul :keyword:`except`. Jeli wyjtek nie "
"zostanie obsuony przez klauzul :keyword:`!except`, zostanie on ponownie "
"rzucony po wykonaniu klauzuli :keyword:`!finally`."

msgid ""
"An exception could occur during execution of an :keyword:`!except` or :"
"keyword:`!else` clause. Again, the exception is re-raised after the :keyword:"
"`!finally` clause has been executed."
msgstr ""
"Wyjtek moe wystpi podczas wykonywania klauzul :keyword:`!except` lub :"
"keyword:`!else`. Ponownie, wyjtek jest ponownie rzucany po wykonaniu "
"klauzuli :keyword:`!finally`."

msgid ""
"If the :keyword:`!finally` clause executes a :keyword:`break`, :keyword:"
"`continue` or :keyword:`return` statement, exceptions are not re-raised. "
"This can be confusing and is therefore discouraged. From version 3.14 the "
"compiler emits a :exc:`SyntaxWarning` for it (see :pep:`765`)."
msgstr ""
"Jeli klauzula :keyword:`!finally` wykonuje :keyword:`break`, :keyword:"
"`continue` lub instrukcj :keyword:`return`, wyjtki nie s dalej rzucane. "
"Moe to by mylce i dlatego jest odradzane. Od wersji 3.14 kompilator "
"emituje :exc:`SyntaxWarning` dla takich przypadkw (patrz :pep:`765`)."

msgid ""
"If the :keyword:`!try` statement reaches a :keyword:`break`, :keyword:"
"`continue` or :keyword:`return` statement, the :keyword:`!finally` clause "
"will execute just prior to the :keyword:`!break`, :keyword:`!continue` or :"
"keyword:`!return` statement's execution."
msgstr ""
"Jeli instrukcja :keyword:`!try` osignie instrukcj :keyword:`break`, :"
"keyword:`continue` lub :keyword:`return`, klauzula :keyword:`!finally` "
"wykona si tu przed wykonaniem instrukcji :keyword:`!break`, :keyword:`!"
"continue` lub :keyword:`!return`."

msgid ""
"If a :keyword:`!finally` clause includes a :keyword:`!return` statement, the "
"returned value will be the one from the :keyword:`!finally` clause's :"
"keyword:`!return` statement, not the value from the :keyword:`!try` "
"clause's :keyword:`!return` statement. This can be confusing and is "
"therefore discouraged. From version 3.14 the compiler emits a :exc:"
"`SyntaxWarning` for it (see :pep:`765`)."
msgstr ""
"Jeli klauzula :keyword:`!finally` zawiera instrukcj :keyword:`!return`, "
"zwrcon wartoci bdzie ta z instrukcji :keyword:`!return` klauzuli :"
"keyword:`!finally`, a nie warto z instrukcji :keyword:`!return` klauzuli :"
"keyword:`!try`. Moe to by mylce i dlatego jest odradzane. Od wersji 3.14 "
"kompilator emituje :exc:`SyntaxWarning` dla takich przypadkw (patrz :pep:"
"`765`)."

msgid "For example::"
msgstr "Na przykad::"

msgid ""
">>> def bool_return():\n"
"...     try:\n"
"...         return True\n"
"...     finally:\n"
"...         return False\n"
"...\n"
">>> bool_return()\n"
"False"
msgstr ""
">>> def bool_return():\n"
"...     try:\n"
"...         return True\n"
"...     finally:\n"
"...         return False\n"
"...\n"
">>> bool_return()\n"
"False"

msgid "A more complicated example::"
msgstr "Bardziej skomplikowany przykad::"

msgid ""
">>> def divide(x, y):\n"
"...     try:\n"
"...         result = x / y\n"
"...     except ZeroDivisionError:\n"
"...         print(\"division by zero!\")\n"
"...     else:\n"
"...         print(\"result is\", result)\n"
"...     finally:\n"
"...         print(\"executing finally clause\")\n"
"...\n"
">>> divide(2, 1)\n"
"result is 2.0\n"
"executing finally clause\n"
">>> divide(2, 0)\n"
"division by zero!\n"
"executing finally clause\n"
">>> divide(\"2\", \"1\")\n"
"executing finally clause\n"
"Traceback (most recent call last):\n"
"  File \"\", line 1, in \n"
"    divide(\"2\", \"1\")\n"
"    ~~~~~~^^^^^^^^^^\n"
"  File \"\", line 3, in divide\n"
"    result = x / y\n"
"             ~~^~~\n"
"TypeError: unsupported operand type(s) for /: 'str' and 'str'"
msgstr ""
">>> def divide(x, y):\n"
"...     try:\n"
"...         result = x / y\n"
"...     except ZeroDivisionError:\n"
"...         print(\"dzielenie przez zero!\")\n"
"...     else:\n"
"...         print(\"wynik to\", result)\n"
"...     finally:\n"
"...         print(\"wykonywanie klauzuli finally\")\n"
"...\n"
">>> divide(2, 1)\n"
"wynik to 2.0\n"
"wykonywanie klauzuli finally\n"
">>> divide(2, 0)\n"
"dzielenie przez zero!\n"
"wykonywanie klauzuli finally\n"
">>> divide(\"2\", \"1\")\n"
"wykonywanie klauzuli finally\n"
"Traceback (most recent call last):\n"
"  File \"\", line 1, in \n"
"    divide(\"2\", \"1\")\n"
"    ~~~~~~^^^^^^^^^^\n"
"  File \"\", line 3, in divide\n"
"    result = x / y\n"
"             ~~^~~\n"
"TypeError: unsupported operand type(s) for /: 'str' and 'str'"

msgid ""
"As you can see, the :keyword:`finally` clause is executed in any event.  "
"The :exc:`TypeError` raised by dividing two strings is not handled by the :"
"keyword:`except` clause and therefore re-raised after the :keyword:`!"
"finally` clause has been executed."
msgstr ""
"Jak wida, klauzula :keyword:`finally` jest wykonywana w kadym przypadku. :"
"exc:`TypeError` rzucony przez dzielenie dwch cigw znakw nie jest "
"obsuony przez klauzul :keyword:`except` i dlatego jest ponownie rzucony "
"po wykonaniu klauzuli :keyword:`!finally`."

msgid ""
"In real world applications, the :keyword:`finally` clause is useful for "
"releasing external resources (such as files or network connections), "
"regardless of whether the use of the resource was successful."
msgstr ""
"W prawdziwych aplikacjach, klauzula :keyword:`finally` jest przydatna do "
"zwalniania zewntrznych zasobw (takich jak pliki lub poczenia sieciowe), "
"niezalenie od tego, czy uycie zasobu zakoczyo si powodzeniem."

msgid "Predefined Clean-up Actions"
msgstr "Predefiniowane akcje porzdkujce"

msgid ""
"Some objects define standard clean-up actions to be undertaken when the "
"object is no longer needed, regardless of whether or not the operation using "
"the object succeeded or failed. Look at the following example, which tries "
"to open a file and print its contents to the screen. ::"
msgstr ""
"Niektre obiekty definiuj standardowe akcje porzdkujce, ktre maj zosta "
"podjte, gdy obiekt nie jest ju potrzebny, niezalenie od tego, czy "
"operacja przy uyciu obiektu powioda si, czy nie. Spjrz na poniszy "
"przykad, ktry prbuje otworzy plik i wydrukowa jego zawarto na "
"ekranie::"

msgid ""
"for line in open(\"myfile.txt\"):\n"
"    print(line, end=\"\")"
msgstr ""
"for line in open(\"moj_plik.txt\"):\n"
"    print(line, end=\"\")"

msgid ""
"The problem with this code is that it leaves the file open for an "
"indeterminate amount of time after this part of the code has finished "
"executing. This is not an issue in simple scripts, but can be a problem for "
"larger applications. The :keyword:`with` statement allows objects like files "
"to be used in a way that ensures they are always cleaned up promptly and "
"correctly. ::"
msgstr ""
"Problem z tym kodem polega na tym, e pozostawia on plik otwarty przez "
"nieokrelony czas po zakoczeniu wykonywania tej czci kodu. Nie jest to "
"problemem w prostych skryptach, ale moe by problemem dla wikszych "
"aplikacjach. Instrukcja :keyword:`with` pozwala na uywanie obiektw takich "
"jak pliki w sposb, ktry zapewnia, e s one zawsze czyszczone szybko i "
"poprawnie::"

msgid ""
"with open(\"myfile.txt\") as f:\n"
"    for line in f:\n"
"        print(line, end=\"\")"
msgstr ""
"with open(\"moj_plik.txt\") as f:\n"
"    for line in f:\n"
"        print(line, end=\"\")"

msgid ""
"After the statement is executed, the file *f* is always closed, even if a "
"problem was encountered while processing the lines. Objects which, like "
"files, provide predefined clean-up actions will indicate this in their "
"documentation."
msgstr ""
"Po wykonaniu instrukcji, plik *f* jest zawsze zamykany, nawet jeli "
"napotkano problem podczas przetwarzania linii. Obiekty, ktre, podobnie jak "
"pliki, zapewniaj predefiniowane akcje czyszczenia, wska to w swojej "
"dokumentacji."

msgid "Raising and Handling Multiple Unrelated Exceptions"
msgstr "Rzucanie i obsuga wielu niepowizanych wyjtkw"

msgid ""
"There are situations where it is necessary to report several exceptions that "
"have occurred. This is often the case in concurrency frameworks, when "
"several tasks may have failed in parallel, but there are also other use "
"cases where it is desirable to continue execution and collect multiple "
"errors rather than raise the first exception."
msgstr ""
"Istniej sytuacje, w ktrych konieczne jest zgoszenie kilku wyjtkw, ktre "
"wystpiy. Dzieje si tak czsto w przypadku frameworkw wspbienoci, gdy "
"kilka zada moe zakoczy si niepowodzeniem rwnolegle, ale istniej "
"rwnie inne przypadki uycia, w ktrych podane jest kontynuowanie "
"wykonywania i zbieranie wielu bdw zamiast rzucenia pierwszego wyjtku."

msgid ""
"The builtin :exc:`ExceptionGroup` wraps a list of exception instances so "
"that they can be raised together. It is an exception itself, so it can be "
"caught like any other exception. ::"
msgstr ""
"Wbudowana :exc:`ExceptionGroup` zawiera list instancji wyjtkw, dziki "
"czemu mog one by rzucone razem. Sama w sobie jest wyjtkiem, wic moe by "
"przechwycona jak kady inny wyjtek::"

msgid ""
">>> def f():\n"
"...     excs = [OSError('error 1'), SystemError('error 2')]\n"
"...     raise ExceptionGroup('there were problems', excs)\n"
"...\n"
">>> f()\n"
"  + Exception Group Traceback (most recent call last):\n"
"  |   File \"\", line 1, in \n"
"  |     f()\n"
"  |     ~^^\n"
"  |   File \"\", line 3, in f\n"
"  |     raise ExceptionGroup('there were problems', excs)\n"
"  | ExceptionGroup: there were problems (2 sub-exceptions)\n"
"  +-+---------------- 1 ----------------\n"
"    | OSError: error 1\n"
"    +---------------- 2 ----------------\n"
"    | SystemError: error 2\n"
"    +------------------------------------\n"
">>> try:\n"
"...     f()\n"
"... except Exception as e:\n"
"...     print(f'caught {type(e)}: {e}')\n"
"...\n"
"caught : there were problems (2 sub-exceptions)\n"
">>>"
msgstr ""
">>> def f():\n"
"...     excs = [OSError('bd 1'), SystemError('bd 2')]\n"
"...     raise ExceptionGroup('byy problemy', excs)\n"
"...\n"
">>> f()\n"
"  + Exception Group Traceback (most recent call last):\n"
"  |   File \"\", line 1, in \n"
"  |     f()\n"
"  |     ~^^\n"
"  |   File \"\", line 3, in f\n"
"  |     raise ExceptionGroup('byy problemy', excs)\n"
"  | ExceptionGroup: byy problemy (2 sub-exceptions)\n"
"  +-+---------------- 1 ----------------\n"
"    | OSError: bd 1\n"
"    +---------------- 2 ----------------\n"
"    | SystemError: bd 2\n"
"    +------------------------------------\n"
">>> try:\n"
"...     f()\n"
"... except Exception as e:\n"
"...     print(f'zapany {type(e)}: {e}')\n"
"...\n"
"zapany : byy problemy (2 sub-exceptions)\n"
">>>"

msgid ""
"By using ``except*`` instead of ``except``, we can selectively handle only "
"the exceptions in the group that match a certain type. In the following "
"example, which shows a nested exception group, each ``except*`` clause "
"extracts from the group exceptions of a certain type while letting all other "
"exceptions propagate to other clauses and eventually to be reraised. ::"
msgstr ""
"Uywajc ``except*`` zamiast ``except``, moemy selektywnie obsugiwa tylko "
"te wyjtki w grupie, ktre pasuj do okrelonego typu. W poniszym "
"przykadzie, ktry pokazuje zagniedon grup wyjtkw, kada klauzula "
"``except*`` wyodrbnia z grupy wyjtki okrelonego typu, pozwalajc "
"wszystkim innym wyjtkom propagowa si do innych klauzul i ostatecznie by "
"ponownie zgaszanymi. ::"

msgid ""
">>> def f():\n"
"...     raise ExceptionGroup(\n"
"...         \"group1\",\n"
"...         [\n"
"...             OSError(1),\n"
"...             SystemError(2),\n"
"...             ExceptionGroup(\n"
"...                 \"group2\",\n"
"...                 [\n"
"...                     OSError(3),\n"
"...                     RecursionError(4)\n"
"...                 ]\n"
"...             )\n"
"...         ]\n"
"...     )\n"
"...\n"
">>> try:\n"
"...     f()\n"
"... except* OSError as e:\n"
"...     print(\"There were OSErrors\")\n"
"... except* SystemError as e:\n"
"...     print(\"There were SystemErrors\")\n"
"...\n"
"There were OSErrors\n"
"There were SystemErrors\n"
"  + Exception Group Traceback (most recent call last):\n"
"  |   File \"\", line 2, in \n"
"  |     f()\n"
"  |     ~^^\n"
"  |   File \"\", line 2, in f\n"
"  |     raise ExceptionGroup(\n"
"  |     ......\n"
"  |     )\n"
"  | ExceptionGroup: group1 (1 sub-exception)\n"
"  +-+---------------- 1 ----------------\n"
"    | ExceptionGroup: group2 (1 sub-exception)\n"
"    +-+---------------- 1 ----------------\n"
"      | RecursionError: 4\n"
"      +------------------------------------\n"
">>>"
msgstr ""
">>> def f():\n"
"...     raise ExceptionGroup(\n"
"...         \"grupa1\",\n"
"...         [\n"
"...             OSError(1),\n"
"...             SystemError(2),\n"
"...             ExceptionGroup(\n"
"...                 \"grupa2\",\n"
"...                 [\n"
"...                     OSError(3),\n"
"...                     RecursionError(4)\n"
"...                 ]\n"
"...             )\n"
"...         ]\n"
"...     )\n"
"...\n"
">>> try:\n"
"...     f()\n"
"... except* OSError as e:\n"
"...     print(\"Byy OSErrors\")\n"
"... except* SystemError as e:\n"
"...     print(\"Byy SystemErrors\")\n"
"...\n"
"Byy OSErrors\n"
"Byy SystemErrors\n"
"  + Exception Group Traceback (most recent call last):\n"
"  |   File \"\", line 2, in \n"
"  |     f()\n"
"  |     ~^^\n"
"  |   File \"\", line 2, in f\n"
"  |     raise ExceptionGroup(\n"
"  |     ......\n"
"  |     )\n"
"  | ExceptionGroup: grupa1 (1 sub-exception)\n"
"  +-+---------------- 1 ----------------\n"
"    | ExceptionGroup: grupa2 (1 sub-exception)\n"
"    +-+---------------- 1 ----------------\n"
"      | RecursionError: 4\n"
"      +------------------------------------\n"
">>>"

msgid ""
"Note that the exceptions nested in an exception group must be instances, not "
"types. This is because in practice the exceptions would typically be ones "
"that have already been raised and caught by the program, along the following "
"pattern::"
msgstr ""
"Naley pamita, e wyjtki zagniedone w grupie wyjtkw musz by "
"instancjami, a nie typami. Wynika to z faktu, e w praktyce wyjtki s "
"zazwyczaj tymi, ktre zostay ju rzucone i przechwycone przez program, "
"zgodnie z nastpujcym wzorcem::"

msgid ""
">>> excs = []\n"
"... for test in tests:\n"
"...     try:\n"
"...         test.run()\n"
"...     except Exception as e:\n"
"...         excs.append(e)\n"
"...\n"
">>> if excs:\n"
"...    raise ExceptionGroup(\"Test Failures\", excs)\n"
"..."
msgstr ""
">>> excs = []\n"
"... for test in tests:\n"
"...     try:\n"
"...         test.run()\n"
"...     except Exception as e:\n"
"...         excs.append(e)\n"
"...\n"
">>> if excs:\n"
"...    raise ExceptionGroup(\"Niepowodzenia testw\", excs)\n"
"..."

msgid "Enriching Exceptions with Notes"
msgstr "Wzbogacanie wyjtkw o notatki"

msgid ""
"When an exception is created in order to be raised, it is usually "
"initialized with information that describes the error that has occurred. "
"There are cases where it is useful to add information after the exception "
"was caught. For this purpose, exceptions have a method ``add_note(note)`` "
"that accepts a string and adds it to the exception's notes list. The "
"standard traceback rendering includes all notes, in the order they were "
"added, after the exception. ::"
msgstr ""
"Gdy wyjtek jest tworzony w celu rzucenia, jest on zwykle inicjowany "
"informacjami opisujcymi bd, ktry wystpi. Istniej przypadki, w ktrych "
"przydatne jest dodanie informacji po przechwyceniu wyjtku. W tym celu "
"wyjtki maj metod ``add_note(note)``, ktra akceptuje cig znakw i dodaje "
"go do listy notatek wyjtku. Standardowe renderowanie tracebacku zawiera "
"wszystkie notatki, w kolejnoci, w jakiej zostay dodane, po wyjtku. ::"

msgid ""
">>> try:\n"
"...     raise TypeError('bad type')\n"
"... except Exception as e:\n"
"...     e.add_note('Add some information')\n"
"...     e.add_note('Add some more information')\n"
"...     raise\n"
"...\n"
"Traceback (most recent call last):\n"
"  File \"\", line 2, in \n"
"    raise TypeError('bad type')\n"
"TypeError: bad type\n"
"Add some information\n"
"Add some more information\n"
">>>"
msgstr ""
">>> try:\n"
"...     raise TypeError('zy typ')\n"
"... except Exception as e:\n"
"...     e.add_note('Dodaj troch informacji')\n"
"...     e.add_note('Dodaj jeszcze troch informacji')\n"
"...     raise\n"
"...\n"
"Traceback (most recent call last):\n"
"  File \"\", line 2, in \n"
"    raise TypeError('zy typ')\n"
"TypeError: zy typ\n"
"Dodaj troch informacji\n"
"Dodaj jeszcze troch informacji\n"
">>>"

msgid ""
"For example, when collecting exceptions into an exception group, we may want "
"to add context information for the individual errors. In the following each "
"exception in the group has a note indicating when this error has occurred. ::"
msgstr ""
"Na przykad zbierajc wyjtki w grup wyjtkw, moemy chcie doda "
"informacje kontekstowe dla poszczeglnych bdw. Poniej kady wyjtek w "
"grupie ma notatk wskazujc, kiedy wystpi. ::"

msgid ""
">>> def f():\n"
"...     raise OSError('operation failed')\n"
"...\n"
">>> excs = []\n"
">>> for i in range(3):\n"
"...     try:\n"
"...         f()\n"
"...     except Exception as e:\n"
"...         e.add_note(f'Happened in Iteration {i+1}')\n"
"...         excs.append(e)\n"
"...\n"
">>> raise ExceptionGroup('We have some problems', excs)\n"
"  + Exception Group Traceback (most recent call last):\n"
"  |   File \"\", line 1, in \n"
"  |     raise ExceptionGroup('We have some problems', excs)\n"
"  | ExceptionGroup: We have some problems (3 sub-exceptions)\n"
"  +-+---------------- 1 ----------------\n"
"    | Traceback (most recent call last):\n"
"    |   File \"\", line 3, in \n"
"    |     f()\n"
"    |     ~^^\n"
"    |   File \"\", line 2, in f\n"
"    |     raise OSError('operation failed')\n"
"    | OSError: operation failed\n"
"    | Happened in Iteration 1\n"
"    +---------------- 2 ----------------\n"
"    | Traceback (most recent call last):\n"
"    |   File \"\", line 3, in \n"
"    |     f()\n"
"    |     ~^^\n"
"    |   File \"\", line 2, in f\n"
"    |     raise OSError('operation failed')\n"
"    | OSError: operation failed\n"
"    | Happened in Iteration 2\n"
"    +---------------- 3 ----------------\n"
"    | Traceback (most recent call last):\n"
"    |   File \"\", line 3, in \n"
"    |     f()\n"
"    |     ~^^\n"
"    |   File \"\", line 2, in f\n"
"    |     raise OSError('operation failed')\n"
"    | OSError: operation failed\n"
"    | Happened in Iteration 3\n"
"    +------------------------------------\n"
">>>"
msgstr ""
">>> def f():\n"
"...     raise OSError('operacja si nie udaa')\n"
"...\n"
">>> excs = []\n"
">>> for i in range(3):\n"
"...     try:\n"
"...         f()\n"
"...     except Exception as e:\n"
"...         e.add_note(f'Zdarzyo si w iteracji {i+1}')\n"
"...         excs.append(e)\n"
"...\n"
">>> raise ExceptionGroup('Mamy jakie problemy', excs)\n"
"  + Exception Group Traceback (most recent call last):\n"
"  |   File \"\", line 1, in \n"
"  |     raise ExceptionGroup('Mamy jakie problemy', excs)\n"
"  | ExceptionGroup: Mamy jakie problemy (3 sub-exceptions)\n"
"  +-+---------------- 1 ----------------\n"
"    | Traceback (most recent call last):\n"
"    |   File \"\", line 3, in \n"
"    |     f()\n"
"    |     ~^^\n"
"    |   File \"\", line 2, in f\n"
"    |     raise OSError('operacja si nie udaa')\n"
"    | OSError: operacja si nie udaa\n"
"    | Zdarzyo si w iteracji 1\n"
"    +---------------- 2 ----------------\n"
"    | Traceback (most recent call last):\n"
"    |   File \"\", line 3, in \n"
"    |     f()\n"
"    |     ~^^\n"
"    |   File \"\", line 2, in f\n"
"    |     raise OSError('operacja si nie udaa')\n"
"    | OSError: operacja si nie udaa\n"
"    | Zdarzyo si w iteracji 2\n"
"    +---------------- 3 ----------------\n"
"    | Traceback (most recent call last):\n"
"    |   File \"\", line 3, in \n"
"    |     f()\n"
"    |     ~^^\n"
"    |   File \"\", line 2, in f\n"
"    |     raise OSError('operacja si nie udaa')\n"
"    | OSError: operacja si nie udaa\n"
"    | Zdarzyo si w iteracji 3\n"
"    +------------------------------------\n"
">>>"

Web Proxy Viewer  |  New URL  |  Original Page