Error - UnboundLocalError: local variable 'authpair' referenced before assignment #7

Closed
opened 2025-10-14 18:06:19 -06:00 by navan · 0 comments
Owner

Originally created by @vishnu6266 on 11/20/2017

Hi @karask ,

Thanks a lot for putting together the project.

I tried creating certificates using the project and got the error "UnboundLocalError: local variable 'authpair' referenced before assignment"

I tried printing out service_url in /new_py3_env/lib/python3.5/site-packages/bitcoin/rpc.py and see that the value is set. authpair variable seems to be have local scope in the if block. Appretiate your help in fixing the issue.

(new_py3_env) bash-4.3# create-certificates -c /etc/data/config.ini

Configured values are:

working_directory:	/etc/data
pdf_cert_template_file:	/etc/data/MOOC7_Cert_Template.pdf
graduates_csv_file:	/etc/data/graduates.csv
certificates_directory:	/etc/data/certificates
cert_names_csv_column:	student_name
issuer:			University of Nicosia
issuer_address:		mr5TnhzymxLLpftDXNHUK7kNNmUnaZY6of
cert_metadata_columns:	student_name,degree_title,percentage_grade,date_of_issuance
Do you want to continue? [y/N]: y
..........
Configured values are:

working_directory:	/etc/data
issuing_address:	mr5TnhzymxLLpftDXNHUK7kNNmUnaZY6of
full_node_url:		127.0.0.1:18332
full_node_rpc_user:	foo
testnet:		True
tx_fee_per_byte:	100
hash_prefix:		None
Do you want to continue? [y/N]: y

Please enter the password for the node's RPC user: 
service_url http://foo:bar@127.0.0.1:18332
Traceback (most recent call last):
  File "/new_py3_env/bin/create-certificates", line 11, in <module>
    load_entry_point('blockchain-certificates==0.10.3', 'console_scripts', 'create-certificates')()
  File "/new_py3_env/lib/python3.5/site-packages/blockchain_certificates/create_certificates.py", line 84, in main
    txid = publish_hash.issue_hash(conf, True, cp.get_merkle_root())
  File "/new_py3_env/lib/python3.5/site-packages/blockchain_certificates/publish_hash.py", line 68, in issue_hash
    conf.full_node_url))
  File "/new_py3_env/lib/python3.5/site-packages/bitcoin/rpc.py", line 312, in __init__
    **kwargs)
  File "/new_py3_env/lib/python3.5/site-packages/bitcoin/rpc.py", line 191, in __init__
    authpair = authpair.encode('utf8')
UnboundLocalError: local variable 'authpair' referenced before assignment

Thanks
Vishnu

*Originally created by @vishnu6266 on 11/20/2017* Hi @karask , Thanks a lot for putting together the project. I tried creating certificates using the project and got the error "UnboundLocalError: local variable 'authpair' referenced before assignment" I tried printing out service_url in /new_py3_env/lib/python3.5/site-packages/bitcoin/rpc.py and see that the value is set. authpair variable seems to be have local scope in the if block. Appretiate your help in fixing the issue. ``` (new_py3_env) bash-4.3# create-certificates -c /etc/data/config.ini Configured values are: working_directory: /etc/data pdf_cert_template_file: /etc/data/MOOC7_Cert_Template.pdf graduates_csv_file: /etc/data/graduates.csv certificates_directory: /etc/data/certificates cert_names_csv_column: student_name issuer: University of Nicosia issuer_address: mr5TnhzymxLLpftDXNHUK7kNNmUnaZY6of cert_metadata_columns: student_name,degree_title,percentage_grade,date_of_issuance Do you want to continue? [y/N]: y .......... Configured values are: working_directory: /etc/data issuing_address: mr5TnhzymxLLpftDXNHUK7kNNmUnaZY6of full_node_url: 127.0.0.1:18332 full_node_rpc_user: foo testnet: True tx_fee_per_byte: 100 hash_prefix: None Do you want to continue? [y/N]: y Please enter the password for the node's RPC user: service_url http://foo:bar@127.0.0.1:18332 Traceback (most recent call last): File "/new_py3_env/bin/create-certificates", line 11, in <module> load_entry_point('blockchain-certificates==0.10.3', 'console_scripts', 'create-certificates')() File "/new_py3_env/lib/python3.5/site-packages/blockchain_certificates/create_certificates.py", line 84, in main txid = publish_hash.issue_hash(conf, True, cp.get_merkle_root()) File "/new_py3_env/lib/python3.5/site-packages/blockchain_certificates/publish_hash.py", line 68, in issue_hash conf.full_node_url)) File "/new_py3_env/lib/python3.5/site-packages/bitcoin/rpc.py", line 312, in __init__ **kwargs) File "/new_py3_env/lib/python3.5/site-packages/bitcoin/rpc.py", line 191, in __init__ authpair = authpair.encode('utf8') UnboundLocalError: local variable 'authpair' referenced before assignment ``` Thanks Vishnu
navan closed this issue 2025-10-14 18:06:20 -06:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github/blockchain-certificates#7
No description provided.