Python 2.7 ha raggiunto la fine del supporto
e verrà
ritirato
il 31 gennaio 2026. Dopo il ritiro, non potrai eseguire il deployment di applicazioni Python 2.7, anche se la tua organizzazione ha utilizzato in precedenza un criterio dell'organizzazione per riattivare i deployment di runtime legacy. Le tue applicazioni Python 2.7 esistenti continueranno a essere eseguite e a ricevere traffico dopo la
data di ritiro. Ti consigliamo di
eseguire la migrazione all'ultima versione supportata di Python.
Eccezioni
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Nota:
gli sviluppatori che creano nuove applicazioni sono vivamente incoraggiati a utilizzare la
libreria client NDB, che offre diversi vantaggi
rispetto a questa libreria client, ad esempio la memorizzazione nella cache automatica delle entità tramite l'API Memcache. Se al momento utilizzi la libreria client DB precedente, leggi la
guida alla migrazione da DB a NDB
Il pacchetto google.appengine.ext.db
fornisce le seguenti classi di eccezione:
- eccezione Error()
-
Questa è la classe di base per tutte le eccezioni in questo pacchetto.
- Eccezione BadArgumentError()
- È stato fornito un argomento non valido a un metodo di query.
- Eccezione BadFilterError()
- Una stringa di filtro nella query non è valida.
- Eccezione BadKeyError()
- La stringa della chiave fornita non è una chiave valida.
- eccezione BadPropertyError()
- Impossibile creare la proprietà perché il nome non è una stringa.
- eccezione BadQueryError()
- La stringa di query non è valida.
- Eccezione BadRequestError()
- La richiesta al servizio di datastore contiene una o più proprietà non valide. Ciò è possibile se una sottoclasse di Model sostituisce alcuni metodi (ad esempio kind()) con un'implementazione errata.
- eccezione BadValueError()
- Non è stato possibile assegnare un valore alla proprietà perché non è valido per il tipo di proprietà.
- eccezione ConfigurationError()
- Una proprietà non è configurata correttamente.
- eccezione DuplicatePropertyError()
- Una definizione del modello ha più di una proprietà con lo stesso nome.
- eccezione InternalError()
- Si è verificato un errore interno al servizio del data store. Questa eccezione non significa necessariamente che l'operazione non sia riuscita.
- Eccezione KindError()
- L'applicazione ha tentato di utilizzare un'entità di dati con una classe di modello non corrispondente all'entità.
- Eccezione NeedIndexError()
- Rilevato quando l'SDK non trova un indice corrispondente per una query che ne richiede uno. Controlla la Console di amministrazione per gestire gli indici e il file index.yaml.
- Eccezione NotSavedError()
- È stata eseguita un'azione che richiede che l'oggetto sia stato salvato (inserito) nel data store, ma l'oggetto non è stato salvato.
- Eccezione PropertyError()
- La proprietà del modello a cui si fa riferimento non esiste nell'oggetto dati.
- eccezione ReferencePropertyResolveError()
- Il modello a cui fa riferimento una ReferenceProperty non esiste. Consulta la sezione Riferimenti.
- Eccezione ReservedWordError()
- Un modello definisce una proprietà il cui nome non è consentito. Consulta Nomi proprietà non consentiti.
- eccezione Rollback()
- Indica che una funzione in una transazione vuole eseguire il rollback della transazione anziché eseguirne il commit. Eventuali eccezioni non rilevate in una transazione ne causeranno il rollback. Questa classe di eccezione è per comodità, quando una funzione vuole eseguire il rollback e non si applicano altre eccezioni.
- eccezione Timeout()
- Eccede quando l'operazione del datastore supera il tempo massimo consentito per le operazioni del datastore. Questa eccezione non significa necessariamente che l'operazione non sia riuscita.
- eccezione TransactionFailedError()
- Non è stato possibile eseguire il commit della transazione o dell'operazione del data store, anche dopo aver riprovato. Questo problema è in genere causato da un tasso elevato di contesa: i dati vengono aggiornati contemporaneamente da molte altre istanze dell'applicazione e questa istanza non è riuscita a eseguire l'commit della transazione entro un numero fisso di tentativi. Vedi Transazioni.
Il pacchetto google.appengine.runtime.apiproxy_errors
fornisce le seguenti classi di eccezione:
- eccezione CapabilityDisabledError()
-
Indica che non è stata eseguita una chiamata all'API del data store perché la funzionalità del data store in questione non è disponibile.
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
Ultimo aggiornamento 2025-09-04 UTC.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[[["\u003cp\u003eDevelopers are highly recommended to utilize the NDB Client Library for new applications due to its enhanced features like automatic entity caching.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egoogle.appengine.ext.db\u003c/code\u003e package offers a range of exception classes to handle various errors related to datastore operations, including issues with arguments, filters, keys, properties, and queries.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egoogle.appengine.runtime.apiproxy_errors\u003c/code\u003e package includes the \u003ccode\u003eCapabilityDisabledError\u003c/code\u003e exception, which signals when a specific datastore functionality is not accessible.\u003c/p\u003e\n"],["\u003cp\u003eSeveral exceptions in \u003ccode\u003egoogle.appengine.ext.db\u003c/code\u003e highlight potential issues in model definition and data consistency, such as \u003ccode\u003eDuplicatePropertyError\u003c/code\u003e, \u003ccode\u003eKindError\u003c/code\u003e, \u003ccode\u003ePropertyError\u003c/code\u003e, \u003ccode\u003eReferencePropertyResolveError\u003c/code\u003e, and \u003ccode\u003eReservedWordError\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe package provides specific error handling for transaction-related issues with classes like \u003ccode\u003eRollback\u003c/code\u003e, and \u003ccode\u003eTransactionFailedError\u003c/code\u003e to help in situations where a transaction needs to be rolled back, or a transaction could not be committed.\u003c/p\u003e\n"]]],[],null,["# Exceptions\n\n**Note:**\nDevelopers building new applications are **strongly encouraged** to use the\n[NDB Client Library](/appengine/docs/legacy/standard/python/ndb), which has several benefits\ncompared to this client library, such as automatic entity caching via the Memcache\nAPI. If you are currently using the older DB Client Library, read the\n[DB to NDB Migration Guide](/appengine/docs/legacy/standard/python/ndb/db_to_ndb)\n\nThe `google.appengine.ext.db` package provides the following exception classes:\n\nexception Error()\n\n: This is the base class for all exceptions in this package.\n\nexception BadArgumentError()\n: A bad argument was given to a query method.\n\nexception BadFilterError()\n: A filter string in the query is invalid.\n\nexception BadKeyError()\n: The provided key string is not a valid key.\n\nexception BadPropertyError()\n: The property could not be created because its name is not a string.\n\nexception BadQueryError()\n: The query string is not a valid query.\n\nexception BadRequestError()\n: The request to the datastore service has one or more invalid properties. This is possible if a subclass of [Model](/appengine/docs/legacy/standard/python/datastore/modelclass) overrides some methods (such as [kind()](/appengine/docs/legacy/standard/python/datastore/modelclass#Model_kind)) with an incorrect implementation.\n\nexception BadValueError()\n: The property could not be assigned a value because the value is invalid for the property type.\n\nexception ConfigurationError()\n: A property is not configured correctly.\n\nexception DuplicatePropertyError()\n: A model definition has more than one property with the same name.\n\nexception InternalError()\n: There was an error internal to the datastore service. This exception does not necessarily mean that the operation failed.\n\nexception KindError()\n: The application attempted to use a data entity with a model class that does not match the entity.\n\nexception NeedIndexError()\n: Raised when the SDK does not find a matching index for a query that requires one. Check the [Administration Console](/appengine/docs/adminconsole) to manage your indexes and your [index.yaml](/appengine/docs/legacy/standard/python/config/indexconfig#creating_datastore_indexes) file.\n\nexception NotSavedError()\n: An action was performed that requires the object to have been saved (put) to the datastore, but the object is not saved.\n\nexception PropertyError()\n: The referenced model property does not exist on the data object.\n\nexception ReferencePropertyResolveError()\n: The model referenced by a [ReferenceProperty](/appengine/docs/legacy/standard/python/datastore/typesandpropertyclasses#ReferenceProperty) does not exist. See [References](/appengine/docs/legacy/standard/python/datastore/datamodeling#References).\n\nexception ReservedWordError()\n: A model defines a property whose name is disallowed. See [Disallowed Property Names](/appengine/docs/legacy/standard/python/datastore/modelclass#Disallowed_Property_Names).\n\nexception Rollback()\n: Indicates that a function in a transaction wants to roll back the transaction instead of committing it. Any uncaught exception in a transaction will cause the transaction to roll back. This exception class is for convenience, when a function wants to roll back and no other exception applies.\n\nexception Timeout()\n: Raised when the datastore operation exceeds the maximum amount of time allowed for datastore operations. This exception does not necessarily mean that the operation failed.\n\nexception TransactionFailedError()\n: The transaction or datastore operation could not be committed, even after retrying. This is usually caused by a high rate of contention: The data is being updated by many other application instances simultaneously, and this instance could not commit its transaction within a fixed number of retries. See [Transactions](/appengine/docs/legacy/standard/python/datastore/transactions).\n\nThe `google.appengine.runtime.apiproxy_errors` package provides the following exception classes:\n\nexception CapabilityDisabledError()\n\n: Indicates that a datastore api call was not performed as that particular datastore functionality is not available."]]