Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I want to use cosmos and evmos at the same time. #16

Closed
tinywolf3 opened this issue Sep 21, 2023 · 1 comment
Closed

I want to use cosmos and evmos at the same time. #16

tinywolf3 opened this issue Sep 21, 2023 · 1 comment

Comments

@tinywolf3
Copy link

Python 3.10.13
mospy-wallet 0.4.2

I want to use cosmos and evmos at the same time.

#!/usr/bin/env python3
import sys
import traceback
import importlib.util
import subprocess

if importlib.util.find_spec("cosmospy_protobuf") is None:
	subprocess.check_call([sys.executable,'-m', 'pip', 'install', '--upgrade', 'cosmospy_protobuf'])
if importlib.util.find_spec("osmosis_protobuf") is None:
	subprocess.check_call([sys.executable,'-m', 'pip', 'install', '--upgrade', 'osmosis_protobuf'])
if importlib.util.find_spec("evmos_protobuf") is None:
	subprocess.check_call([sys.executable,'-m', 'pip', 'install', '--upgrade', 'evmos_protobuf'])

try:
	from mospy import Account, Transaction
	from mospy.clients import HTTPClient
except:
	subprocess.check_call([sys.executable,'-m', 'pip', 'install', '--upgrade', 'mospy-wallet'])
	from mospy import Account, Transaction
	from mospy.clients import HTTPClient


seed = "law grab theory better athlete submit awkward hawk state wedding wave monkey audit blame fury wood tag rent furnace exotic jeans drift destroy style"

print('-- cosm_account')
try:
	cosm_account = Account(
		seed_phrase=seed,
		address_index=0,
		hrp="cosmos",
		protobuf="cosmos",
		eth=False,
	)
except Exception:
	traceback.print_exc()

print('-- evm_account')
try:
	evm_account = Account(
		seed_phrase=seed,
		address_index=0,
		hrp="evmos",
		protobuf="evmos",
		eth=False,
	)
except Exception:
	traceback.print_exc()

print('-- next')
# ...

However, I got an error like the below.

❯ python test.py
-- cosm_account
-- evm_account
Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.10/site-packages/mospy/Account.py", line 61, in __init__
    self.keys_pb2 = importlib.import_module(
  File "/opt/homebrew/Cellar/[email protected]/3.10.13/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/opt/homebrew/lib/python3.10/site-packages/evmos_protobuf/cosmos/crypto/secp256k1/keys_pb2.py", line 7, in <module>
    from ....gogoproto import gogo_pb2 as gogoproto_dot_gogo__pb2
  File "/opt/homebrew/lib/python3.10/site-packages/evmos_protobuf/gogoproto/gogo_pb2.py", line 8, in <module>
    DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x14gogoproto/gogo.proto\x12\tgogoproto\x1a ... \x01(\tBH\n\x13com.google.protobufB\nGoGoProtosZ%github.com/cosmos/gogoproto/gogoproto')
TypeError: Couldn't build proto file into descriptor pool: duplicate file name gogoproto/gogo.proto

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/sdjeong/Documents/Works/pyCosmos/test.py", line 39, in <module>
    evm_account = Account(
  File "/opt/homebrew/lib/python3.10/site-packages/mospy/Account.py", line 68, in __init__
    raise ImportError(
ImportError: Couldn't import from evmos_protobuf. Is the package installed?
-- next

What's the problem?
Is there a workaround?

@ctrl-Felix
Copy link
Owner

#26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants