monero-ecosystem / monero-python

A comprehensive Python module for handling Monero cryptocurrency
BSD 3-Clause "New" or "Revised" License
245 stars 79 forks source link

ModuleNotFoundError: No module named 'monero.wallet'; 'monero' is not a package #30

Closed Endogen closed 6 years ago

Endogen commented 6 years ago

I get this error if i try to execute this code:

from monero.wallet import Wallet
from monero.backends.jsonrpc import JSONRPCWallet

w = Wallet(JSONRPCWallet(port=28088))
w.address()
w.balance()

But monero-python is already installed

Endogen commented 6 years ago

Works now

dorian9007 commented 3 years ago

what was the solution?

Endogen commented 3 years ago

I don't know anymore :-D Too long ago but this was my working code:

from monero.wallet import Wallet
from monero.backends.jsonrpc import JSONRPCWallet

w = Wallet(JSONRPCWallet(port=28088))
print("Address: " + str(w.address()))
print("Balance: " + str(w.balance()))

addr = w.new_address()
print("New Address: " + str(addr))

amount = 0.5
trx = w.transfer(addr, amount)  # TODO: NotEnoughUnlockedMoney: not enough unlocked money
print("Send " + str(amount) + " XMR to " + str(addr) + "\n" + str(trx))
print("Transaction fee: " + str(trx[0].fee) + " and Timestamp: " + str(trx[0].timestamp))

print("Balance: " + str(w.balance()))
acc = w.new_account()
new_addr = acc.new_address()

new_amount = 0.1
new_trx = w.transfer(new_addr, new_amount)
print("Send " + str(new_amount) + " XMR to " + str(new_addr) + "\n" + str(new_trx))
dorian9007 commented 3 years ago

thank you!