Python Forum
How do I get the in3.Client() to create a variable with attributes? (in3 pypi pckge)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I get the in3.Client() to create a variable with attributes? (in3 pypi pckge)
#1
Using Python 3 and the in3 imported package, how do I get the in3.Client() to create a variable with attributes .account and .contract? I am using Python 3. The last two lines of this code (taken from https://pypi.org/project/in3/) fail:

import in3
in3_client = in3.Client()
block_number = in3_client.eth.block_number()
print(block_number) 
in3_client  # incubed network api 
in3_client.eth  # ethereum api
in3_client.account  # ethereum account api
in3_client.contract  # ethereum smart-contract api
I expect in3_client.account and in3_client.contract to work (or have a value). I get an error like this:

Quote: AttributeError: module 'in3_client' has no attribute 'account'

I tried to find out what member objects the in3_client instance/object has. I ran this:

>>> in3_client = in3.Client()
>>> print(in3_client.__dict__.keys())
dict_keys(['_runtime', 'eth', '_factory'])
Based on the above result, I see no "account" or "contract" (but I do see _runtime, eth, and _factory. How can .account and .contract be attributes of a variable created from in3.Client()? The documentation here indicates it should work.
Reply
#2
Don't know anything about ethereum, but I see some similar names under the eth object. Perhaps the docs are out of date or typoed?

So would instead be:

in3_client.eth  # ethereum api
in3_client.eth.account  # ethereum account api
in3_client.eth.contract  # ethereum smart-contract api
Reply
#3
Thanks. That helped.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to create a variable only for use inside the scope of a while loop? Radical 10 1,724 Nov-07-2023, 09:49 AM
Last Post: buran
  loop (create variable where name is dependent on another variable) brianhclo 1 1,140 Aug-05-2022, 07:46 AM
Last Post: bowlofred
  Create variable and list dynamically quest_ 12 4,417 Jan-26-2021, 07:14 PM
Last Post: quest_
  Create new variable dependent on two existing variables JoeOpdenaker 6 3,021 Oct-25-2020, 02:15 PM
Last Post: jefsummers
  Can I use iteration to create variable names? Mark17 8 6,852 Oct-17-2019, 06:05 AM
Last Post: perfringo
  How do I create a Dynamic Variable? Nwb 1 2,758 Jun-10-2018, 11:50 AM
Last Post: volcano63
  Is it possible to create a variable with the name of an output of another variable Panda 8 4,586 Jun-06-2018, 09:14 PM
Last Post: Panda
  Trying to create a python exe for an addition problem with an odd variable Python_Newb 0 2,153 Nov-30-2017, 12:18 PM
Last Post: Python_Newb

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020