Error in Example - Build with Python - General - Algorand
Error in Example - Build with Python
post by alireza.pirgazi on Feb 17, 2022
Run python3 example.py then this Error
┌──(venv)─(scalper㉿kali)-[~/Desktop/auction-demo]
└─$ python3 example.py 1 ⨯
Generating temporary accounts...
Traceback (most recent call last):
File "/usr/lib/python3.9/urllib/request.py", line 1346, in do_open
h.request(req.get_method(), req.selector, req.data, headers,
File "/usr/lib/python3.9/http/client.py", line 1285, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.9/http/client.py", line 1331, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib/python3.9/http/client.py", line 1280, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib/python3.9/http/client.py", line 1040, in send_output
self.send(msg)
File "/usr/lib/python3.9/http/client.py", line 980, in send
self.connect()
File "/usr/lib/python3.9/http/client.py", line 946, in connect
self.sock = self._create_connection(
File "/usr/lib/python3.9/socket.py", line 844, in create_connection
raise err
File "/usr/lib/python3.9/socket.py", line 832, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/scalper/Desktop/auction-demo/example.py", line 122, in <module>
simple_auction()
File "/home/scalper/Desktop/auction-demo/example.py", line 23, in simple_auction
creator = getTemporaryAccount(client)
File "/home/scalper/Desktop/auction-demo/auction/testing/resources.py", line 48, in getTemporaryAccount
genesisAccounts = getGenesisAccounts()
File "/home/scalper/Desktop/auction-demo/auction/testing/setup.py", line 36, in getGenesisAccounts
wallets = kmd.list_wallets()
File "/home/scalper/Desktop/auction-demo/venv/lib/python3.9/site-packages/algosdk/kmd.py", line 88, in list_wallets
res = self.kmd_request("GET", req)
File "/home/scalper/Desktop/auction-demo/venv/lib/python3.9/site-packages/algosdk/kmd.py", line 61, in kmd_request
resp = urlopen(req)
File "/usr/lib/python3.9/urllib/request.py", line 214, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.9/urllib/request.py", line 517, in open
response = self._open(req, data)
File "/usr/lib/python3.9/urllib/request.py", line 534, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
File "/usr/lib/python3.9/urllib/request.py", line 494, in _call_chain
result = func(*args)
File "/usr/lib/python3.9/http/client.py", line 1375, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "/usr/lib/python3.9/http/client.py", line 1349, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 111] Connection refused>
post by fabrice on Feb 17, 2022
Most likely the URL you gave to create the algod client is incorrect.
Can you show your code? (replace any secret token/key with “**”)
How do you connect to the network? There are 3 options explained there: Set up your development environment - Algorand Developer Portal
post by alireza.pirgazi on Feb 17, 2022
The code is the same as the tutorial example
https://developer.algorand.org/docs/get-started/dapps/pyteal/
post by fabrice on Feb 17, 2022
In that case, most likely sandbox is not running properly.
Have you successfully run the step Build with Python - Algorand Developer Portal?
post by alireza.pirgazi on Feb 17, 2022
The output of the test is as follows
What do you think is the problem?
┌──(scalper㉿kali)-[~/Desktop/sandbox]
└─$ ./sandbox up testnet
Starting sandbox for: testnet
see sandbox.log for detailed progress, or use -v.
* started!
algod version
┌──(scalper㉿kali)-[~/Desktop/sandbox]
└─$ ./sandbox test 1 ⨯
Test command forwarding...
~$ docker exec -it algod uname -a
post by fabrice on Feb 17, 2022
There is a bug somewhere, the output should contain much more information.
Please provide sandbox.log or run ./sandbox up testnet -v.
I've also opened an issue Improve output in case of error · Issue #103 · algorand/sandbox · GitHub that you can upvote to improve error handling.
post by alireza.pirgazi on Feb 17, 2022
$ ./sandbox log
sandbox commands:
up [config] -> start the sandbox environment.
down -> tear down the sandbox environment.
reset -> reset the containers to their initial state.
clean -> stops and deletes containers and data directory.
test -> runs some tests to demonstrate usage.
enter [algod||indexer||indexer-db]
-> enter the sandbox container.
version -> print binary versions.
copyTo <file> -> copy <file> into the algod. Useful for offline transactions, offline LogicSigs & TEAL work.
copyFrom <file> -> copy <file> from the algod. Useful for offline transactions, offline LogicSigs & TEAL work.
algorand commands:
logs -> stream algorand logs with the carpenter utility.
status -> get node status.
goal (args) -> run goal command like 'goal node status'.
special flags for 'up' command:
-v|--verbose -> display verbose output when starting standbox.
-s|--skip-fast-catchup -> skip catchup when connecting to real network.
-i|--interactive -> start docker-compose in interactive mode.
post by fabrice on Feb 18, 2022
Hello my dear friend
Changing the operating system to Ubuntu did not solve the problem
Solved by changing the operating system DNS.
Grateful
┌──(venv)─(scalper㉿kali)-[~/Desktop/auction-demo]
└─$ python3 example.py
Generating temporary accounts...
Alice (seller account): GQWSLYREYFSSQIC5TAX3OW6NPTMDATJTX6HOWW6PODKD33PD3QYNLP3AWU
Bob (auction creator account): EA2ZHTOPHI7ACOTGQNAVE2O4V6HQF5OGQMG3ZMHQTCO2MO2SMXAFJGTNZI
Carla (bidder account) GLMXXTP6Y2MWXQZQ2DCUHWJA4PV4AMA7EVOGCO3NZDNRW37I2FXS22MOCI
Alice is generating an example NFT...
The NFT ID is 17
Alice's balances: {0: 99999000, 17: 1}
Bob is creating an auction that lasts 30 seconds to auction off the NFT...
Done. The auction app ID is 18 and the escrow account is TYLKPGKW3Q2XA3WRE4VIL3SAJXBC2OIK37RMBO52Q6K4MAPMXKVXLNFCM
Alice is setting up and funding NFT auction...
Done
Alice's balances: {0: 99998000, 17: 0}
Auction escrow balances: {0: 202000, 17: 1}
Carla wants to bid on NFT, her balances: {0: 100000000}
Carla is placing bid for 1000000 microAlgos
Carla is opting into NFT with ID 17
Done
Waiting 17 seconds for the auction to finish
Alice is closing out the auction
The auction escrow now holds the following: {0: 0}
Alice's balances after auction: {0: 101197000, 17: 0} Algos
Carla's balances after auction: {0: 98997000, 17: 1} Algos
post by fabrice on Feb 20, 2022
Good to know it’s fixed.
Indeed, limited ISP DNS may cause issues.