Ethereum: Oshchybotki in Wall Python

At the writing of the wall, which will intensify with the blockchain ethereum, using the counter -library of Openzepeplin or the Second Staron API, it is inrauding with the scales. One public problem is connected with the exclusions of the API. In this state, we dissatisfied, why do you become a table with the obliqueing of the classes, which do not inherit from BaseException ', and the implementation for the imagery.

Combining Osh

Ethereum: Python 3 handling error TypeError: catching classes that do not inherit from BaseException is not allowed

Oshbuzhka „Typeerror: Classes that do not inherit from the basic” indicates that the code is asked to the class in the class, Wipes classes for all the exclusion in Python. This is possible for the use of the TRY-Except or the copies of the Polish classes.

Code

Let’s proanize the sorted sight of the code:

Python

I = 0

POCO I 5:

I = I + 1

ask:

Sellsta = client.get_ern

Crower Client.get_order How E:

Print („Error:” E)

Problem

In this code “I” there is a cellar -in -law, initiated to 0. When you have a cicilian with the superior value of 5, it will go 4 times, and the cate will come out of the cycle.

However, the demand for release client.get_order, you passsymbol = symbol, orderid = sellorder, recvwindow = delaying in the cure of arguments. In addition to these values, it is not defined in this region (then there is no need for this block of code), python caught a scoop that eats the Try-Except unit.

solving

To decide this problem, you need to realize that all the translation and functions in the block, where the disclosure, there is an adverbial value of the initiation. Odin from the sake of it-spoken the key word “global” for access to a non-colored part-point:

`Python

I = 0

POCO I 5:

ask:

Sellsta = client.get_ern

Crower Exclusion How E:

Print („Error:”, Str (E))

In the qualities of Alternate, you can define the interpretables “symbol” and “adjacent” ahead of the cycling:

`Python

I = 0

Symbol = ‘SYMB’

Pile = 5

Pok i

ask:

Sellsta = Client.get_order (Symbol = Symbol, Orderid = Selldernum, Recvwindow = Dower)

Crower Exclusion How E:

Print („Error:”, Str (E))

The best projects

To go away in the future:

  • It is always necessary to convene the expanding with the adverbial meaning of the inicalization within the framework, where they are used.
  • Use Global to access to a non -colored expiry that they can be punished that their values ​​are correct.

Delivery these decisions, you are able to firmly enlist the exclusions and first of the way, do not fit the “Typeerror: Blooms who do not inherit from the bastexception”.

Share This:

Source