Repository navigation
Expand file tree
/
Copy pathexceptions.po
More file actions
1818 lines (1614 loc) · 80.1 KB
/
Copy pathexceptions.po
File metadata and controls
1818 lines (1614 loc) · 80.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Copyright (C) 2001 Python Software Foundation
# This file is distributed under the same license as the Python package.
#
# Translators:
# Leon H., 2017
msgid ""
msgstr ""
"Project-Id-Version: Python 3.14\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-09-14 00:21+0000\n"
"PO-Revision-Date: 2024-12-20 16:57+0800\n"
"Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n"
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
"tw)\n"
"Language: zh_TW\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../../builtins/exceptions.rst:4
msgid "Built-in Exceptions"
msgstr "內建的例外"
#: ../../builtins/exceptions.rst:10
msgid ""
"In Python, all exceptions must be instances of a class that derives "
"from :class:`BaseException`. In a :keyword:`try` statement with "
"an :keyword:`except` clause that mentions a particular class, that clause "
"also handles any exception classes derived from that class (but not "
"exception classes from which *it* is derived). Two exception classes that "
"are not related via subclassing are never equivalent, even if they have the "
"same name."
msgstr ""
"在 Python 中,所有例外必須是從 :class:`BaseException` 衍生的類別的實例。在陳"
"述式 :keyword:`try` 搭配 :keyword:`except` 子句裡提到一個特定的類別時,那個子"
"句也會處理任何從該類別衍生的例外類別(但不會處理該類別\\ *衍生自*\\ 的例外類"
"別)。兩個不是由子類別關係關聯起來的例外類別永遠不相等,就算它們有相同的名稱"
"也是如此。"
#: ../../builtins/exceptions.rst:19
msgid ""
"The built-in exceptions listed in this chapter can be generated by the "
"interpreter or built-in functions. Except where mentioned, they have an "
"\"associated value\" indicating the detailed cause of the error. This may "
"be a string or a tuple of several items of information (e.g., an error code "
"and a string explaining the code). The associated value is usually passed "
"as arguments to the exception class's constructor."
msgstr ""
"此章節裡列出的內建例外可以從直譯器或內建函式產生。除了特別提到的地方之外,它"
"們會有一個\\ *關聯值*\\ 表示錯誤發生的詳細原因。這可能是一個字串,或者是一些"
"資訊項目組成的元組(例如一個錯誤代碼及一個解釋該代碼的字串)。這個關聯值通常"
"當作引數傳遞給例外類別的建構函式。"
#: ../../builtins/exceptions.rst:26
msgid ""
"User code can raise built-in exceptions. This can be used to test an "
"exception handler or to report an error condition \"just like\" the "
"situation in which the interpreter raises the same exception; but beware "
"that there is nothing to prevent user code from raising an inappropriate "
"error."
msgstr ""
"使用者的程式碼可以引發內建例外。這可以用來測試例外處理器或者用來回報一個錯誤"
"條件,*就像*\\ 直譯器會引發相同例外的情況;但需要注意的是沒有任何方式可以避免"
"使用者的程式碼引發不適當的錯誤。"
#: ../../builtins/exceptions.rst:31
msgid ""
"The built-in exception classes can be subclassed to define new exceptions; "
"programmers are encouraged to derive new exceptions from "
"the :exc:`Exception` class or one of its subclasses, and not "
"from :exc:`BaseException`. More information on defining exceptions is "
"available in the Python Tutorial under :ref:`tut-userexceptions`."
msgstr ""
"可以從內建的例外類別定義新的例外子類別;程式設計師被鼓勵從 :exc:`Exception` "
"類別或其子類別衍生新的例外,而不是從 :exc:`BaseException` 來衍生。更多關於定"
"義例外的資訊可以在 Python 教學中的\\ :ref:`tut-userexceptions`\\ 裡取得。"
#: ../../builtins/exceptions.rst:39
msgid "Exception context"
msgstr "例外的情境"
#: ../../builtins/exceptions.rst:46
msgid ""
"Three attributes on exception objects provide information about the context "
"in which the exception was raised:"
msgstr "三個例外物件上的屬性提供關於引發此例外的情境的資訊:"
#: ../../builtins/exceptions.rst:53
msgid ""
"When raising a new exception while another exception is already being "
"handled, the new exception's :attr:`!__context__` attribute is automatically "
"set to the handled exception. An exception may be handled when "
"an :keyword:`except` or :keyword:`finally` clause, or a :keyword:`with` "
"statement, is used."
msgstr ""
"當引發一個新的例外而同時有另一個例外已經正在被處理時,這個新例外的 :attr:`!"
"__context__` 屬性會自動被設成那個已處理的例外。當使用 :keyword:`except` "
"或 :keyword:`finally` 子句或 :keyword:`with` 陳述式的時候例外會被處理。"
#: ../../builtins/exceptions.rst:59
msgid ""
"This implicit exception context can be supplemented with an explicit cause "
"by using :keyword:`!from` with :keyword:`raise`::"
msgstr ""
"這個隱含的例外情境可以透過使用 :keyword:`!from` 搭配 :keyword:`raise` 來補充"
"明確的原因: ::"
#: ../../builtins/exceptions.rst:63
msgid "raise new_exc from original_exc"
msgstr "raise new_exc from original_exc"
#: ../../builtins/exceptions.rst:65
msgid ""
"The expression following :keyword:`from<raise>` must be an exception or "
"``None``. It will be set as :attr:`!__cause__` on the raised exception. "
"Setting :attr:`!__cause__` also implicitly sets the :attr:`!"
"__suppress_context__` attribute to ``True``, so that using ``raise new_exc "
"from None`` effectively replaces the old exception with the new one for "
"display purposes (e.g. converting :exc:`KeyError` to :exc:`AttributeError`), "
"while leaving the old exception available in :attr:`!__context__` for "
"introspection when debugging."
msgstr ""
"在 :keyword:`from<raise>` 後面的運算式必須是一個例外或 ``None``。它將會被設定"
"成所引發例外的 :attr:`!__cause__`。設定 :attr:`!__cause__` 也隱含地設"
"定 :attr:`!__suppress_context__` 屬性為 ``True``,因此使用 ``raise new_exc "
"from None`` 實際上會以新的例外取代舊的例外以利於顯示(例如轉"
"換 :exc:`KeyError` 為 :exc:`AttributeError`),同時保持舊的例外可以透"
"過 :attr:`!__context__` 取得以方便 debug 的時候檢查。"
#: ../../builtins/exceptions.rst:74
msgid ""
"The default traceback display code shows these chained exceptions in "
"addition to the traceback for the exception itself. An explicitly chained "
"exception in :attr:`!__cause__` is always shown when present. An implicitly "
"chained exception in :attr:`!__context__` is shown only if :attr:`!"
"__cause__` is :const:`None` and :attr:`!__suppress_context__` is false."
msgstr ""
"預設的回溯 (traceback) 顯示程式碼會顯示這些連鎖的例外 (chained exception) 加"
"上例外本身的回溯。當存在的時候,在 :attr:`!__cause__` 中明確地連鎖的例外總是"
"會被顯示。而在 :attr:`!__context__` 中隱含地連鎖的例外只有當 :attr:`!"
"__cause__` 是 :const:`None` 且 :attr:`!__suppress_context__` 是 false 時才會"
"顯示。"
#: ../../builtins/exceptions.rst:80
msgid ""
"In either case, the exception itself is always shown after any chained "
"exceptions so that the final line of the traceback always shows the last "
"exception that was raised."
msgstr ""
"在任一種情況下,例外本身總是會顯示在任何連鎖例外的後面,因此回溯的最後一列總"
"是顯示最後一個被引發的例外。"
#: ../../builtins/exceptions.rst:86
msgid "Inheriting from built-in exceptions"
msgstr "繼承自內建的例外"
#: ../../builtins/exceptions.rst:88
msgid ""
"User code can create subclasses that inherit from an exception type. It's "
"recommended to only subclass one exception type at a time to avoid any "
"possible conflicts between how the bases handle the ``args`` attribute, as "
"well as due to possible memory layout incompatibilities."
msgstr ""
"使用者的程式碼可以建立繼承自例外型別的子類別。建議一次只繼承一種例外型別以避"
"免在基底類別之間如何處理 ``args`` 屬性的任何可能衝突,以及可能的記憶體佈局 "
"(memory layout) 不相容。"
#: ../../builtins/exceptions.rst:95
msgid ""
"Most built-in exceptions are implemented in C for efficiency, "
"see: :source:`Objects/exceptions.c`. Some have custom memory layouts which "
"makes it impossible to create a subclass that inherits from multiple "
"exception types. The memory layout of a type is an implementation detail and "
"might change between Python versions, leading to new conflicts in the "
"future. Therefore, it's recommended to avoid subclassing multiple exception "
"types altogether."
msgstr ""
"為了效率,大部分的內建例外使用 C 來實作,參考 :source:`Objects/"
"exceptions.c`。一些例外有客製化的記憶體佈局,使其不可能建立一個繼承多種例外型"
"別的子類別。型別的記憶體佈局是實作細節且可能會在不同 Python 版本間改變,造成"
"未來新的衝突。因此,總之建議避免繼承多種例外型別。"
#: ../../builtins/exceptions.rst:105
msgid "Base classes"
msgstr "基底類別 (base classes)"
#: ../../builtins/exceptions.rst:107
msgid ""
"The following exceptions are used mostly as base classes for other "
"exceptions."
msgstr "以下的例外大部分被用在當作其他例外的基底類別。"
#: ../../builtins/exceptions.rst:111
msgid ""
"The base class for all built-in exceptions. It is not meant to be directly "
"inherited by user-defined classes (for that, use :exc:`Exception`). "
"If :func:`str` is called on an instance of this class, the representation of "
"the argument(s) to the instance are returned, or the empty string when there "
"were no arguments."
msgstr ""
"所有內建例外的基底類別。這不是為了讓使用者定義的類別直接繼承(可以使"
"用 :exc:`Exception`)。如果在這個類別的實例上呼叫 :func:`str`,會回傳實例的引"
"數的表示,或者沒有引數的時候會回傳空字串。"
#: ../../builtins/exceptions.rst:119
msgid ""
"The tuple of arguments given to the exception constructor. Some built-in "
"exceptions (like :exc:`OSError`) expect a certain number of arguments and "
"assign a special meaning to the elements of this tuple, while others are "
"usually called only with a single string giving an error message."
msgstr ""
"提供給該例外建構函式的引數元組。一些內建的例外(像是 :exc:`OSError`)預期接受"
"特定數量的引數並賦予該元組的每一個元素一個特別的意義,其他例外則通常用一個提"
"供錯誤訊息的單一字串來呼叫。"
#: ../../builtins/exceptions.rst:126
msgid ""
"This method sets *tb* as the new traceback for the exception and returns the "
"exception object. It was more commonly used before the exception chaining "
"features of :pep:`3134` became available. The following example shows how "
"we can convert an instance of ``SomeException`` into an instance of "
"``OtherException`` while preserving the traceback. Once raised, the current "
"frame is pushed onto the traceback of the ``OtherException``, as would have "
"happened to the traceback of the original ``SomeException`` had we allowed "
"it to propagate to the caller. ::"
msgstr ""
"此方法設定 *tb* 為該例外的新的回溯並回傳該例外物件。在 :pep:`3134` 的例外連鎖"
"功能變得可用之前,此方法曾被更普遍使用。下面的範例顯示我們如何將 "
"``SomeException`` 的實例轉換為 ``OtherException`` 的實例同時保留回溯。一旦被"
"引發,目前的 frame 會被加進 ``OtherException`` 的回溯,就像原來 "
"``SomeException`` 的回溯會發生的一樣,我們允許它被傳遞給呼叫者: ::"
#: ../../builtins/exceptions.rst:135
msgid ""
"try:\n"
" ...\n"
"except SomeException:\n"
" tb = sys.exception().__traceback__\n"
" raise OtherException(...).with_traceback(tb)"
msgstr ""
"try:\n"
" ...\n"
"except SomeException:\n"
" tb = sys.exception().__traceback__\n"
" raise OtherException(...).with_traceback(tb)"
#: ../../builtins/exceptions.rst:143
msgid ""
"A writable field that holds the :ref:`traceback object <traceback-objects>` "
"associated with this exception. See also: :ref:`raise`."
msgstr ""
"可寫入的欄位,儲存關聯到該例外的\\ :ref:`回溯物件 <traceback-objects>`。也可"
"以參考 :ref:`raise`。"
#: ../../builtins/exceptions.rst:149
msgid ""
"Add the string ``note`` to the exception's notes which appear in the "
"standard traceback after the exception string. A :exc:`TypeError` is raised "
"if ``note`` is not a string."
msgstr ""
"新增字串 ``note`` 到例外的備註,在標準的回溯裡,備註出現在例外字串的後面。如"
"果 ``note`` 不是字串則引發 :exc:`TypeError`。"
#: ../../builtins/exceptions.rst:157
msgid ""
"A list of the notes of this exception, which were added "
"with :meth:`add_note`. This attribute is created when :meth:`add_note` is "
"called."
msgstr ""
"該例外的備註串列,使用 :meth:`add_note` 來新增。此屬性在 :meth:`add_note` 被"
"呼叫的時候建立。"
#: ../../builtins/exceptions.rst:165
msgid ""
"All built-in, non-system-exiting exceptions are derived from this class. "
"All user-defined exceptions should also be derived from this class."
msgstr ""
"所有內建、非系統退出 (non-system-exiting) 的例外都衍生自此類別。所有使用者定"
"義的例外應該也要衍生自此類別。"
#: ../../builtins/exceptions.rst:171
msgid ""
"The base class for those built-in exceptions that are raised for various "
"arithmetic "
"errors: :exc:`OverflowError`, :exc:`ZeroDivisionError`, :exc:`FloatingPointError`."
msgstr ""
"各種運算錯誤所引發的那些內建例"
"外::exc:`OverflowError`、:exc:`ZeroDivisionError`、:exc:`FloatingPointError` "
"的基底類別。"
#: ../../builtins/exceptions.rst:178
msgid ""
"Raised when a :ref:`buffer <bufferobjects>` related operation cannot be "
"performed."
msgstr ""
"當\\ :ref:`緩衝 (buffer) <bufferobjects>` 相關的操作無法被執行時會引發此例"
"外。"
#: ../../builtins/exceptions.rst:184
msgid ""
"The base class for the exceptions that are raised when a key or index used "
"on a mapping or sequence is invalid: :exc:`IndexError`, :exc:`KeyError`. "
"This can be raised directly by :func:`codecs.lookup`."
msgstr ""
"當使用在對映或序列上的鍵或索引是無效的時候所引發的例"
"外::exc:`IndexError`、:exc:`KeyError` 的基底類別。這可以"
"被 :func:`codecs.lookup` 直接引發。"
#: ../../builtins/exceptions.rst:190
msgid "Concrete exceptions"
msgstr "實體例外"
#: ../../builtins/exceptions.rst:192
msgid "The following exceptions are the exceptions that are usually raised."
msgstr "以下的例外是通常會被引發的例外。"
#: ../../builtins/exceptions.rst:198
msgid "Raised when an :keyword:`assert` statement fails."
msgstr "當 :keyword:`assert` 陳述式失敗的時候被引發。"
#: ../../builtins/exceptions.rst:203
msgid ""
"Raised when an attribute reference (see :ref:`attribute-references`) or "
"assignment fails. (When an object does not support attribute references or "
"attribute assignments at all, :exc:`TypeError` is raised.)"
msgstr ""
"當屬性參照(參考 :ref:`attribute-references`)或賦值失敗的時候被引發。(當物"
"件根本不支援屬性參照或屬性賦值的時候,:exc:`TypeError` 會被引發。)"
#: ../../builtins/exceptions.rst:207
msgid ""
"The optional *name* and *obj* keyword-only arguments set the corresponding "
"attributes:"
msgstr "可選的僅限關鍵字引數 *name* 和 *obj* 會設定對應的屬性:"
#: ../../builtins/exceptions.rst:212
msgid "The name of the attribute that was attempted to be accessed."
msgstr "嘗試被存取的屬性名稱。"
#: ../../builtins/exceptions.rst:216
msgid "The object that was accessed for the named attribute."
msgstr "存取指定屬性的物件。"
#: ../../builtins/exceptions.rst:218
msgid "Added the :attr:`name` and :attr:`obj` attributes."
msgstr "新增 :attr:`name` 與 :attr:`obj` 屬性。"
#: ../../builtins/exceptions.rst:223
msgid ""
"Raised when the :func:`input` function hits an end-of-file condition (EOF) "
"without reading any data. (Note: the :meth:`io.TextIOBase.read` "
"and :meth:`io.IOBase.readline` methods return an empty string when they hit "
"EOF.)"
msgstr ""
"當 :func:`input` 函式在沒有讀到任何資料而到達檔案結尾 (end-of-file, EOF) 條件"
"的時候被引發。(注意::meth:`io.TextIOBase.read` "
"和 :meth:`io.IOBase.readline` 方法當達到 EOF 時會回傳空字串。)"
#: ../../builtins/exceptions.rst:230
msgid "Not currently used."
msgstr "目前沒有被使用。"
#: ../../builtins/exceptions.rst:235
msgid ""
"Raised when a :term:`generator` or :term:`coroutine` is closed; "
"see :meth:`generator.close` and :meth:`coroutine.close`. It directly "
"inherits from :exc:`BaseException` instead of :exc:`Exception` since it is "
"technically not an error."
msgstr ""
"當 :term:`generator` 或 :term:`coroutine` 被關閉的時候被引發;參"
"考 :meth:`generator.close` 和 :meth:`coroutine.close`。此例外直接繼承"
"自 :exc:`BaseException` 而不是 :exc:`Exception`,因為技術上來說這不是一個錯"
"誤。"
#: ../../builtins/exceptions.rst:243
msgid ""
"Raised when the :keyword:`import` statement has troubles trying to load a "
"module. Also raised when the \"from list\" in ``from ... import`` has a "
"name that cannot be found."
msgstr ""
"當 :keyword:`import` 陳述式嘗試載入模組遇到問題的時候會被引發。當 ``from ... "
"import`` 裡的 \"from list\" 包含找不到的名稱時也會被引發。"
#: ../../builtins/exceptions.rst:247
msgid ""
"The optional *name* and *path* keyword-only arguments set the corresponding "
"attributes:"
msgstr "可選的僅限關鍵字引數 *name* 和 *path* 設定對應的屬性:"
#: ../../builtins/exceptions.rst:252
msgid "The name of the module that was attempted to be imported."
msgstr "嘗試引入 (import) 的模組名稱。"
#: ../../builtins/exceptions.rst:256
msgid "The path to any file which triggered the exception."
msgstr "觸發此例外的任何檔案的路徑。"
#: ../../builtins/exceptions.rst:258
msgid "Added the :attr:`name` and :attr:`path` attributes."
msgstr "新增 :attr:`name` 與 :attr:`path` 屬性。"
#: ../../builtins/exceptions.rst:263
msgid ""
"A subclass of :exc:`ImportError` which is raised by :keyword:`import` when a "
"module could not be located. It is also raised when ``None`` is found "
"in :data:`sys.modules`."
msgstr ""
":exc:`ImportError` 的子類別,當模組不能被定位的時候會被 :keyword:`import` 所"
"引發。當在 :data:`sys.modules` 裡找到 ``None`` 時也會被引發。"
#: ../../builtins/exceptions.rst:272
msgid ""
"Raised when a sequence subscript is out of range. (Slice indices are "
"silently truncated to fall in the allowed range; if an index is not an "
"integer, :exc:`TypeError` is raised.)"
msgstr ""
"當序列的索引超出範圍的時候會被引發。(切片索引 (slice indices) 會默默地被截短"
"使其能落在允許的範圍內;如果索引不是整數,:exc:`TypeError` 會被引發。)"
#: ../../builtins/exceptions.rst:281
msgid ""
"Raised when a mapping (dictionary) key is not found in the set of existing "
"keys."
msgstr "當對映(字典)的鍵無法在已存在的鍵的集合中被找到時會被引發。"
#: ../../builtins/exceptions.rst:288
msgid ""
"Raised when the user hits the interrupt key (normally :kbd:`Control-C` "
"or :kbd:`Delete`). During execution, a check for interrupts is made "
"regularly. The exception inherits from :exc:`BaseException` so as to not be "
"accidentally caught by code that catches :exc:`Exception` and thus prevent "
"the interpreter from exiting."
msgstr ""
"當使用者輸入中斷鍵 (interrupt key)(一般來說是 :kbd:`Control-C` "
"或 :kbd:`Delete`)時會被引發。在執行過程中,會定期檢查是否產生中斷。此例外繼"
"承自 :exc:`BaseException` 以防止意外地被捕捉 :exc:`Exception` 的程式碼所捕"
"捉,而因此讓直譯器無法結束。"
#: ../../builtins/exceptions.rst:296
msgid ""
"Catching a :exc:`KeyboardInterrupt` requires special consideration. Because "
"it can be raised at unpredictable points, it may, in some circumstances, "
"leave the running program in an inconsistent state. It is generally best to "
"allow :exc:`KeyboardInterrupt` to end the program as quickly as possible or "
"avoid raising it entirely. (See :ref:`handlers-and-exceptions`.)"
msgstr ""
"捕捉 :exc:`KeyboardInterrupt` 需要特殊的考量。因為它可以在無法預期的時間點被"
"引發,可能在某些情況下讓正在跑的程式處在一個不一致的狀態。一般來說最好"
"讓 :exc:`KeyboardInterrupt` 越快結束程式越好,或者完全避免引發它。(參"
"考 :ref:`handlers-and-exceptions`。)"
#: ../../builtins/exceptions.rst:306
msgid ""
"Raised when an operation runs out of memory but the situation may still be "
"rescued (by deleting some objects). The associated value is a string "
"indicating what kind of (internal) operation ran out of memory. Note that "
"because of the underlying memory management architecture "
"(C's :c:func:`malloc` function), the interpreter may not always be able to "
"completely recover from this situation; it nevertheless raises an exception "
"so that a stack traceback can be printed, in case a run-away program was the "
"cause."
msgstr ""
"當一個操作用光了記憶體但情況還可能被修復 (rescued)(透過刪除一些物件)的時候"
"被引發。關聯值是一個字串,表示什麼類型的(內部)操作用光了記憶體。需注意的是"
"因為底層的記憶體管理架構(C 的 :c:func:`malloc` 函式),直譯器可能無法總是完"
"整地從該情況中修復;僅管如此,它還是引發例外以讓堆疊回溯可以被印出,以防原因"
"出在失控的程式。"
#: ../../builtins/exceptions.rst:317
msgid ""
"Raised when a local or global name is not found. This applies only to "
"unqualified names. The associated value is an error message that includes "
"the name that could not be found."
msgstr ""
"當找不到本地或全域的名稱時會被引發。這只應用在不合格的名稱 (unqualified "
"name) 上。關聯值是一個錯誤訊息,包含那個無法被找到的名稱。"
#: ../../builtins/exceptions.rst:321
msgid "The optional *name* keyword-only argument sets the attribute:"
msgstr "可選的僅限關鍵字引數 *name* 設定對應的屬性:"
#: ../../builtins/exceptions.rst:325
msgid "The name of the variable that was attempted to be accessed."
msgstr "嘗試被存取的變數名稱。"
#: ../../builtins/exceptions.rst:327
msgid "Added the :attr:`name` attribute."
msgstr "新增 :attr:`name` 屬性。"
#: ../../builtins/exceptions.rst:333
msgid ""
"This exception is derived from :exc:`RuntimeError`. In user defined base "
"classes, abstract methods should raise this exception when they require "
"derived classes to override the method, or while the class is being "
"developed to indicate that the real implementation still needs to be added."
msgstr ""
"此例外衍生自 :exc:`RuntimeError`。在使用者定義的基礎類別裡,當抽象方法要求衍"
"生類別覆寫該方法時應該要引發此例外,或者當類別正在開發中,可用此例外表示還需"
"要加入真正的實作。"
#: ../../builtins/exceptions.rst:340
msgid ""
"It should not be used to indicate that an operator or method is not meant to "
"be supported at all -- in that case either leave the operator / method "
"undefined or, if a subclass, set it to :data:`None`."
msgstr ""
"此例外不應該用來表示根本沒有要支援的運算子或方法 ── 在這個情況下可以讓該運算"
"子或方法保持未定義,或者如果是子類別的話將其設成 :data:`None`。"
#: ../../builtins/exceptions.rst:346
msgid ""
":exc:`!NotImplementedError` and :data:`!NotImplemented` are not "
"interchangeable. This exception should only be used as described above; "
"see :data:`NotImplemented` for details on correct usage of the built-in "
"constant."
msgstr ""
":exc:`!NotImplementedError` 和 :data:`!NotImplemented` 並不是可互換的。這個例"
"外只能用在上面描述的情況;參考 :data:`NotImplemented` 裡關於內建常數正確使用"
"方法的細節。"
#: ../../builtins/exceptions.rst:357
msgid ""
"This exception is raised when a system function returns a system-related "
"error, including I/O failures such as \"file not found\" or \"disk full\" "
"(not for illegal argument types or other incidental errors)."
msgstr ""
"當系統函式回傳系統相關錯誤,包含像\"找不到檔案\"或\"硬碟已滿\"的 I/O 失敗會引"
"發此例外(而非不合法的引數或其他次要的錯誤)。"
#: ../../builtins/exceptions.rst:361
msgid ""
"The second form of the constructor sets the corresponding attributes, "
"described below. The attributes default to :const:`None` if not specified. "
"For backwards compatibility, if three arguments are passed, "
"the :attr:`~BaseException.args` attribute contains only a 2-tuple of the "
"first two constructor arguments."
msgstr ""
"建構函式的第二種形式會設定以下描述的相對應屬性。如果沒有給定則屬性預設"
"為 :const:`None`。為了向後相容,如果傳入三個引"
"數,:attr:`~BaseException.args` 屬性只會是包含建構函式前兩個引數的雙元素元"
"組。"
#: ../../builtins/exceptions.rst:367
msgid ""
"The constructor often actually returns a subclass of :exc:`OSError`, as "
"described in `OS exceptions`_ below. The particular subclass depends on the "
"final :attr:`.errno` value. This behaviour only occurs when "
"constructing :exc:`OSError` directly or via an alias, and is not inherited "
"when subclassing."
msgstr ""
"如同下面的\\ `作業系統例外 <OS exceptions_>`_\\ 所描述,實際上建構函式通常回"
"傳 :exc:`OSError` 的子類別。會依據最後 :attr:`.errno` 的值決定特定子類別。這"
"個行為只發生在直接建構 :exc:`OSError` 或透過別名,且產生子類別的時候不會被繼"
"承。"
#: ../../builtins/exceptions.rst:375
msgid "A numeric error code from the C variable :c:data:`errno`."
msgstr "從 C 變數 :c:data:`errno` 而來的數值錯誤代碼。"
#: ../../builtins/exceptions.rst:379
msgid ""
"Under Windows, this gives you the native Windows error code. "
"The :attr:`.errno` attribute is then an approximate translation, in POSIX "
"terms, of that native error code."
msgstr ""
"在 Windows 下,這會提供你原生的 Windows 錯誤代碼。而 :attr:`.errno` 屬性是一"
"個該原生錯誤代碼對於 POSIX 來說的近似翻譯。"
#: ../../builtins/exceptions.rst:383
msgid ""
"Under Windows, if the *winerror* constructor argument is an integer, "
"the :attr:`.errno` attribute is determined from the Windows error code, and "
"the *errno* argument is ignored. On other platforms, the *winerror* "
"argument is ignored, and the :attr:`winerror` attribute does not exist."
msgstr ""
"在 Windows 下,如果建構函式引數 *winerror* 是整數,則 :attr:`.errno` 屬性會根"
"據該 Windows 錯誤代碼來決定,且 *errno* 引數會被忽略。在其他平台上,"
"*winerror* 引數會被忽略,而 :attr:`winerror` 屬性會不存在。"
#: ../../builtins/exceptions.rst:391
msgid ""
"The corresponding error message, as provided by the operating system. It is "
"formatted by the C functions :c:func:`!perror` under POSIX, and :c:func:`!"
"FormatMessage` under Windows."
msgstr ""
"作業系統提供的對應錯誤訊息。在 POSIX 下會使用 C 函式 :c:func:`!perror` 做格式"
"化,而在 Windows 下會使用 :c:func:`!FormatMessage`。"
#: ../../builtins/exceptions.rst:399
msgid ""
"For exceptions that involve a file system path (such as :func:`open` "
"or :func:`os.unlink`), :attr:`filename` is the file name passed to the "
"function. For functions that involve two file system paths (such "
"as :func:`os.rename`), :attr:`filename2` corresponds to the second file name "
"passed to the function."
msgstr ""
"對於包含檔案系統路徑的例外(像是 :func:`open` "
"或 :func:`os.unlink`),:attr:`filename` 是傳入函式的檔案名稱。對於包含兩個檔"
"案系統路徑的函式(像是 :func:`os.rename`),:attr:`filename2` 對應到傳入函式"
"的第二個檔案名稱。"
#: ../../builtins/exceptions.rst:406
msgid ""
":exc:`EnvironmentError`, :exc:`IOError`, :exc:`WindowsError`, :exc:`socket.error`, :exc:`select.error` "
"and :exc:`!mmap.error` have been merged into :exc:`OSError`, and the "
"constructor may return a subclass."
msgstr ""
":exc:`EnvironmentError`、:exc:`IOError`、:exc:`WindowsError`、:exc:`socket.error`、:exc:`select.error` "
"及 :exc:`!mmap.error` 已合併進 :exc:`OSError`,而建構函式可能會回傳子類別。"
#: ../../builtins/exceptions.rst:412
msgid ""
"The :attr:`filename` attribute is now the original file name passed to the "
"function, instead of the name encoded to or decoded from "
"the :term:`filesystem encoding and error handler`. Also, the *filename2* "
"constructor argument and attribute was added."
msgstr ""
":attr:`filename` 屬性現在是傳入函式的原始檔名,而不是從\\ :term:`檔案系統編碼"
"和錯誤處理函式 <filesystem encoding and error handler>`\\ 編碼或解碼過的名"
"稱。並且新增 *filename2* 建構函式引數與屬性。"
#: ../../builtins/exceptions.rst:421
msgid ""
"Raised when the result of an arithmetic operation is too large to be "
"represented. This cannot occur for integers (which would rather "
"raise :exc:`MemoryError` than give up). However, for historical reasons, "
"OverflowError is sometimes raised for integers that are outside a required "
"range. Because of the lack of standardization of floating-point exception "
"handling in C, most floating-point operations are not checked."
msgstr ""
"當運算操作的結果太大而無法表示的時候會引發此例外。這不會發生在整數上(會改成"
"引發 :exc:`MemoryError` 而不是放棄)。然而,因為一些歷史因素,OverflowError "
"有時候會因為整數在要求範圍之外而引發。因為在 C 裡面缺乏浮點數例外處理的標準"
"化,大部分的浮點數運算都沒有被檢查。"
#: ../../builtins/exceptions.rst:431
msgid ""
"This exception is derived from :exc:`RuntimeError`. It is raised when an "
"operation is blocked during interpreter shutdown also known as :term:`Python "
"finalization <interpreter shutdown>`."
msgstr ""
"此例外衍生自 :exc:`RuntimeError`。當一個操作在直譯器關閉(也稱"
"作 :term:`Python 最終化 (Python finalization) <interpreter shutdown>`)期間"
"被阻塞會引發此例外。"
#: ../../builtins/exceptions.rst:435
msgid ""
"Examples of operations which can be blocked with "
"a :exc:`PythonFinalizationError` during the Python finalization:"
msgstr ""
"在 Python 最終化期間,能夠以 :exc:`PythonFinalizationError` 被阻塞的操作範"
"例:"
#: ../../builtins/exceptions.rst:438
msgid "Creating a new Python thread."
msgstr "建立新的 Python 執行緒。"
#: ../../builtins/exceptions.rst:439
msgid ":meth:`Joining <threading.Thread.join>` a running daemon thread."
msgstr ":meth:`Join <threading.Thread.join>` 一個執行中的常駐執行緒。"
#: ../../builtins/exceptions.rst:440
msgid ":func:`os.fork`."
msgstr ":func:`os.fork`。"
#: ../../builtins/exceptions.rst:442
msgid "See also the :func:`sys.is_finalizing` function."
msgstr "也可以參閱 :func:`sys.is_finalizing` 函式。"
#: ../../builtins/exceptions.rst:444 ../../builtins/exceptions.rst:457
msgid "Previously, a plain :exc:`RuntimeError` was raised."
msgstr "在之前,會引發一般的 :exc:`RuntimeError`。"
#: ../../builtins/exceptions.rst:449
msgid ":meth:`threading.Thread.join` can now raise this exception."
msgstr ":meth:`threading.Thread.join` 現在可以引發此例外。"
#: ../../builtins/exceptions.rst:453
msgid ""
"This exception is derived from :exc:`RuntimeError`. It is raised when the "
"interpreter detects that the maximum recursion depth "
"(see :func:`sys.getrecursionlimit`) is exceeded."
msgstr ""
"此例外衍生自 :exc:`RuntimeError`。當直譯器偵測到超過最大的遞迴深度(參"
"考 :func:`sys.getrecursionlimit`)時會引發此例外。"
#: ../../builtins/exceptions.rst:463
msgid ""
"This exception is raised when a weak reference proxy, created by "
"the :func:`weakref.proxy` function, is used to access an attribute of the "
"referent after it has been garbage collected. For more information on weak "
"references, see the :mod:`weakref` module."
msgstr ""
"當一個被 :func:`weakref.proxy` 函式建立的弱參照代理 (weak reference proxy) 被"
"用來存取已經被垃圾回收 (garbage collected) 的參照物屬性時會引發此例外。更多關"
"於弱參照的資訊參考 :mod:`weakref` 模組。"
#: ../../builtins/exceptions.rst:471
msgid ""
"Raised when an error is detected that doesn't fall in any of the other "
"categories. The associated value is a string indicating what precisely went "
"wrong."
msgstr ""
"當偵測到一個不屬於任何其他種類的錯誤時會引發此例外。關聯值是一個表示確切什麼"
"地方出錯的字串。"
#: ../../builtins/exceptions.rst:478
msgid ""
"Raised by built-in function :func:`next` and "
"an :term:`iterator`\\'s :meth:`~iterator.__next__` method to signal that "
"there are no further items produced by the iterator."
msgstr ""
"會被內建函式 :func:`next` 及 :term:`iterator` 的 :meth:`~iterator.__next__` "
"方法引發,用來表示疊代器沒有更多項目可以產生。"
#: ../../builtins/exceptions.rst:484
msgid ""
"The exception object has a single attribute :attr:`!value`, which is given "
"as an argument when constructing the exception, and defaults "
"to :const:`None`."
msgstr ""
"此例外物件有單一屬性 :attr:`!value`,當建構此例外時會以引數給定,預設"
"為 :const:`None`。"
#: ../../builtins/exceptions.rst:488
msgid ""
"When a :term:`generator` or :term:`coroutine` function returns, a "
"new :exc:`StopIteration` instance is raised, and the value returned by the "
"function is used as the :attr:`value` parameter to the constructor of the "
"exception."
msgstr ""
"當 :term:`generator` 或 :term:`coroutine` 函式回傳時,新"
"的 :exc:`StopIteration` 實例會被引發,而該函式的回傳值會被用來當作此例外建構"
"函式的 :attr:`value` 參數。"
#: ../../builtins/exceptions.rst:493
msgid ""
"If a generator code directly or indirectly raises :exc:`StopIteration`, it "
"is converted into a :exc:`RuntimeError` (retaining the :exc:`StopIteration` "
"as the new exception's cause)."
msgstr ""
"如果產生器程式直接或間接引發 :exc:`StopIteration`,則其會被轉換"
"成 :exc:`RuntimeError`\\ (保留 :exc:`StopIteration` 作為新例外的成因)。"
#: ../../builtins/exceptions.rst:497
msgid ""
"Added ``value`` attribute and the ability for generator functions to use it "
"to return a value."
msgstr "新增 ``value`` 屬性且產生器函式可以用它來回傳值。"
#: ../../builtins/exceptions.rst:501
msgid ""
"Introduced the RuntimeError transformation via ``from __future__ import "
"generator_stop``, see :pep:`479`."
msgstr ""
"透過 ``from __future__ import generator_stop`` 引入 RuntimeError 的轉換,參"
"考 :pep:`479`。"
#: ../../builtins/exceptions.rst:505
msgid ""
"Enable :pep:`479` for all code by default: a :exc:`StopIteration` error "
"raised in a generator is transformed into a :exc:`RuntimeError`."
msgstr ""
"預設對所有程式啟用 :pep:`479`:在產生器引發的 :exc:`StopIteration` 錯誤會轉換"
"成 :exc:`RuntimeError`。"
#: ../../builtins/exceptions.rst:511
msgid ""
"Must be raised by :meth:`~object.__anext__` method of an :term:`asynchronous "
"iterator` object to stop the iteration."
msgstr ""
"此例外必須被 :term:`asynchronous iterator` 物件的 :meth:`~object.__anext__` "
"方法引發來停止疊代。"
#: ../../builtins/exceptions.rst:518
msgid ""
"Raised when the parser encounters a syntax error. This may occur in "
"an :keyword:`import` statement, in a call to the built-in "
"functions :func:`compile`, :func:`exec`, or :func:`eval`, or when reading "
"the initial script or standard input (also interactively)."
msgstr ""
"當剖析器遇到語法錯誤時會引發此例外。這可能發生在 :keyword:`import` 陳述式、在"
"呼叫內建函式 :func:`compile`、:func:`exec` 或 :func:`eval` 的時候,或者在讀取"
"初始腳本或標準輸入(也包含互動式)的時候。"
#: ../../builtins/exceptions.rst:524
msgid ""
"The :func:`str` of the exception instance returns only the error message. "
"Details is a tuple whose members are also available as separate attributes."
msgstr ""
"例外實例的 :func:`str` 只回傳錯誤訊息。Details 是個元組,其成員也能夠以分開的"
"屬性取得。"
#: ../../builtins/exceptions.rst:529
msgid "The name of the file the syntax error occurred in."
msgstr "發生語法錯誤所在的檔案名稱。"
#: ../../builtins/exceptions.rst:533
msgid ""
"Which line number in the file the error occurred in. This is 1-indexed: the "
"first line in the file has a ``lineno`` of 1."
msgstr ""
"發生錯誤所在檔案的列號。這是以 1 開始的索引:檔案第一列的 ``lineno`` 是 1。"
#: ../../builtins/exceptions.rst:538
msgid ""
"The column in the line where the error occurred. This is 1-indexed: the "
"first character in the line has an ``offset`` of 1."
msgstr ""
"發生錯誤所在該列的欄號 (column)。這是以 1 開始的索引:該列第一個字元的 "
"``offset`` 是 1。"
#: ../../builtins/exceptions.rst:543
msgid "The source code text involved in the error."
msgstr "涉及該錯誤的原始程式碼文字。"
#: ../../builtins/exceptions.rst:547
msgid ""
"Which line number in the file the error occurred ends in. This is 1-indexed: "
"the first line in the file has a ``lineno`` of 1."
msgstr ""
"發生錯誤所在檔案的結束列號。這是以 1 開始的索引:檔案第一列的 ``lineno`` 是 "
"1。"
#: ../../builtins/exceptions.rst:552
msgid ""
"The column in the end line where the error occurred finishes. This is 1-"
"indexed: the first character in the line has an ``offset`` of 1."
msgstr ""
"發生錯誤所在該結束列的欄號。這是以 1 開始的索引:該列第一個字元的 ``offset`` "
"是 1。"
#: ../../builtins/exceptions.rst:555
msgid ""
"For errors in f-string fields, the message is prefixed by \"f-string: \" and "
"the offsets are offsets in a text constructed from the replacement "
"expression. For example, compiling f'Bad {a b} field' results in this args "
"attribute: ('f-string: ...', ('', 1, 2, '(a b)\\n', 1, 5))."
msgstr ""
"對於發生在 f-string 欄位的錯誤,訊息會以 \"f-string: \" 為前綴,而偏移量 "
"(offset) 是從替代運算式建構的文字的偏移量。例如編譯 f'Bad {a b} field' 會得到"
"這個 args 屬性:('f-string: ...', ('', 1, 2, '(a b)\\n', 1, 5))。"
#: ../../builtins/exceptions.rst:560
msgid "Added the :attr:`end_lineno` and :attr:`end_offset` attributes."
msgstr "新增 :attr:`end_lineno` 與 :attr:`end_offset` 屬性。"
#: ../../builtins/exceptions.rst:565
msgid ""
"Base class for syntax errors related to incorrect indentation. This is a "
"subclass of :exc:`SyntaxError`."
msgstr ""
"與不正確的縮排有關的語法錯誤的基礎類別。這是 :exc:`SyntaxError` 的子類別。"
#: ../../builtins/exceptions.rst:571
msgid ""
"Raised when indentation contains an inconsistent use of tabs and spaces. "
"This is a subclass of :exc:`IndentationError`."
msgstr ""
"當縮排包含製表符號 (tab) 和空白的不一致用法時會引發此例外。這"
"是 :exc:`IndentationError` 的子類別。"
#: ../../builtins/exceptions.rst:577
msgid ""
"Raised when the interpreter finds an internal error, but the situation does "
"not look so serious to cause it to abandon all hope. The associated value is "
"a string indicating what went wrong (in low-level terms). "
"In :term:`CPython`, this could be raised by incorrectly using Python's C "
"API, such as returning a ``NULL`` value without an exception set."
msgstr ""
"當直譯器找到一個內部錯誤,但該情況看起來沒有嚴重到要讓它放棄所有的希望時會引"
"發此例外。關聯值是一個表示什麼地方出錯的字串(以低階的方式表達)。"
"在 :term:`CPython` 中,這可能是因為錯誤地使用 Python 的 C API,例如回傳一個 "
"``NULL`` 值而沒有設定例外。"
#: ../../builtins/exceptions.rst:583
msgid ""
"If you're confident that this exception wasn't your fault, or the fault of a "
"package you're using, you should report this to the author or maintainer of "
"your Python interpreter. Be sure to report the version of the Python "
"interpreter (``sys.version``; it is also printed at the start of an "
"interactive Python session), the exact error message (the exception's "
"associated value) and if possible the source of the program that triggered "
"the error."
msgstr ""
"如果你確定這個例外不是你的或者所用套件的錯,你應該向你的 Python 直譯器作者或"
"維護者回報此錯誤。務必要回報該 Python 直譯器的版本(``sys.version``;這也會在"
"互動式 Python 會話的開頭被印出)、確切的錯誤訊息(該例外的關聯值)及如果可能"
"的話,觸發此錯誤的程式來源。"
#: ../../builtins/exceptions.rst:594
msgid ""
"This exception is raised by the :func:`sys.exit` function. It inherits "
"from :exc:`BaseException` instead of :exc:`Exception` so that it is not "
"accidentally caught by code that catches :exc:`Exception`. This allows the "
"exception to properly propagate up and cause the interpreter to exit. When "
"it is not handled, the Python interpreter exits; no stack traceback is "
"printed. The constructor accepts the same optional argument passed "
"to :func:`sys.exit`. If the value is an integer, it specifies the system "
"exit status (passed to C's :c:func:`!exit` function); if it is ``None``, the "
"exit status is zero; if it has another type (such as a string), the object's "
"value is printed and the exit status is one."
msgstr ""
"此例外會被 :func:`sys.exit` 函式引發。它繼承自 :exc:`BaseException` 而不"
"是 :exc:`Exception` 因此不會被捕捉 :exc:`Exception` 的程式意外地捕捉。這允許"
"例外可以正確地向上傳遞並導致直譯器結束。當它未被處理時,Python 直譯器會結束;"
"不會印出堆疊回溯。建構函式接受跟傳入 :func:`sys.exit` 一樣的可選引數。如果該"
"值是整數,它會指定系統的結束狀態(傳入 C 的 :c:func:`!exit` 函式);如果它是 "
"``None``,結束狀態會是 0;如果它是其他型別(例如字串),則物件的值會被印出而"
"結束狀態是 1。"
#: ../../builtins/exceptions.rst:605
msgid ""
"A call to :func:`sys.exit` is translated into an exception so that clean-up "
"handlers (:keyword:`finally` clauses of :keyword:`try` statements) can be "
"executed, and so that a debugger can execute a script without running the "
"risk of losing control. The :func:`os._exit` function can be used if it is "
"absolutely positively necessary to exit immediately (for example, in the "
"child process after a call to :func:`os.fork`)."
msgstr ""
"對 :func:`sys.exit` 的呼叫會轉譯成例外讓負責清理的處理函式(:keyword:`try` 陳"
"述式的 :keyword:`finally` 子句)可以被執行,且讓除錯器可以在不冒著失去控制的"
"風險下執行腳本。如果在絕對有必要立即結束的情況(例如在子行程呼叫"
"完 :func:`os.fork` 之後 )可以使用 :func:`os._exit` 函式。"
#: ../../builtins/exceptions.rst:614
msgid ""
"The exit status or error message that is passed to the constructor. "
"(Defaults to ``None``.)"
msgstr "傳入建構函式的結束狀態或錯誤訊息。(預設是 ``None``。 )"
#: ../../builtins/exceptions.rst:620
msgid ""
"Raised when an operation or function is applied to an object of "
"inappropriate type. The associated value is a string giving details about "
"the type mismatch."
msgstr ""
"當一個操作或函式被用在不適合的型別的物件時會引發此例外。關聯值是一個字串,提"
"供關於不相符型別的細節。"
#: ../../builtins/exceptions.rst:623
msgid ""
"This exception may be raised by user code to indicate that an attempted "
"operation on an object is not supported, and is not meant to be. If an "
"object is meant to support a given operation but has not yet provided an "
"implementation, :exc:`NotImplementedError` is the proper exception to raise."
msgstr ""
"此例外可能被使用者程式碼引發,以表示並不支援物件上所嘗試的操作,且本來就無意"
"這樣做。如果一個物件有意要支援某個給定的操作但尚未提供實作,該引發的正確例外"
"是 :exc:`NotImplementedError`。"
#: ../../builtins/exceptions.rst:628
msgid ""
"Passing arguments of the wrong type (e.g. passing a :class:`list` when "
"an :class:`int` is expected) should result in a :exc:`TypeError`, but "
"passing arguments with the wrong value (e.g. a number outside expected "
"boundaries) should result in a :exc:`ValueError`."
msgstr ""
"傳入錯誤型別的引數(例如當預期傳入 :class:`int` 卻傳入 :class:`list`)應該要"
"導致 :exc:`TypeError`,但傳入帶有錯誤值的引數(例如超出預期範圍的數值)應該要"
"導致 :exc:`ValueError`。"
#: ../../builtins/exceptions.rst:635
msgid ""
"Raised when a reference is made to a local variable in a function or method, "
"but no value has been bound to that variable. This is a subclass "
"of :exc:`NameError`."
msgstr ""
"當在函式或方法裡引用某個區域變數,但該變數尚未被繫結到任何值的時候會引發此例"
"外。這是 :exc:`NameError` 的子類別。"
#: ../../builtins/exceptions.rst:642
msgid ""
"Raised when a Unicode-related encoding or decoding error occurs. It is a "
"subclass of :exc:`ValueError`."
msgstr ""
"當 Unicode 相關的編碼或解碼錯誤發生時會引發此例外。這是 :exc:`ValueError` 的"
"子類別。"
#: ../../builtins/exceptions.rst:645
msgid ""
":exc:`UnicodeError` has attributes that describe the encoding or decoding "
"error. For example, ``err.object[err.start:err.end]`` gives the particular "
"invalid input that the codec failed on."
msgstr ""
":exc:`UnicodeError` 有屬性描述編碼或解碼錯誤。例如 "
"``err.object[err.start:err.end]`` 會提供讓編解碼器失敗的具體無效輸入。"
#: ../../builtins/exceptions.rst:651
msgid "The name of the encoding that raised the error."
msgstr "引發錯誤的編碼名稱。"
#: ../../builtins/exceptions.rst:655
msgid "A string describing the specific codec error."
msgstr "描述特定編解碼器錯誤的字串。"
#: ../../builtins/exceptions.rst:659
msgid "The object the codec was attempting to encode or decode."
msgstr "編解碼器嘗試編碼或解碼的物件。"