Tribler / py-ipv8

Python implementation of Tribler's IPv8 p2p-networking layer
GNU Lesser General Public License v3.0
231 stars 47 forks source link

IPv8 Can no longer be run standalone #288

Closed qstokkink closed 6 years ago

qstokkink commented 6 years ago
$ python ipv8_service.py 
Traceback (most recent call last):
  File "ipv8_service.py", line 12, in <module>
    from .ipv8.messaging.interfaces.statistics_endpoint import StatisticsEndpoint
ValueError: Attempted relative import in non-package
devos50 commented 6 years ago

Hmm this is a serious issue. Any idea how to fix it?

qstokkink commented 6 years ago

@devos50

if __name__ == '__main__':
    from ipv8.messaging.interfaces.statistics_endpoint import StatisticsEndpoint
    from ipv8.attestation.identity.community import IdentityCommunity
    from ipv8.attestation.trustchain.community import TrustChainCommunity, TrustChainTestnetCommunity
    from ipv8.attestation.wallet.community import AttestationCommunity
    from ipv8.keyvault.crypto import ECCrypto
    from ipv8.keyvault.private.m2crypto import M2CryptoSK
    from ipv8.messaging.anonymization.community import TunnelCommunity
    from ipv8.messaging.anonymization.hidden_services import HiddenTunnelCommunity
    from ipv8.messaging.interfaces.udp.endpoint import UDPEndpoint
    from ipv8.peer import Peer
    from ipv8.peerdiscovery.churn import RandomChurn
    from ipv8.peerdiscovery.deprecated.discovery import DiscoveryCommunity
    from ipv8.peerdiscovery.discovery import EdgeWalk, RandomWalk
    from ipv8.peerdiscovery.network import Network
    from ipv8.dht.discovery import DHTDiscoveryCommunity
else:
    from .ipv8.messaging.interfaces.statistics_endpoint import StatisticsEndpoint
    from .ipv8.attestation.identity.community import IdentityCommunity
    from .ipv8.attestation.trustchain.community import TrustChainCommunity, TrustChainTestnetCommunity
    from .ipv8.attestation.wallet.community import AttestationCommunity
    from .ipv8.keyvault.crypto import ECCrypto
    from .ipv8.keyvault.private.m2crypto import M2CryptoSK
    from .ipv8.messaging.anonymization.community import TunnelCommunity
    from .ipv8.messaging.anonymization.hidden_services import HiddenTunnelCommunity
    from .ipv8.messaging.interfaces.udp.endpoint import UDPEndpoint
    from .ipv8.peer import Peer
    from .ipv8.peerdiscovery.churn import RandomChurn
    from .ipv8.peerdiscovery.deprecated.discovery import DiscoveryCommunity
    from .ipv8.peerdiscovery.discovery import EdgeWalk, RandomWalk
    from .ipv8.peerdiscovery.network import Network
    from .ipv8.dht.discovery import DHTDiscoveryCommunity
devos50 commented 6 years ago

That's also what I thought about. I can't think about a better solution to fix this, unfortunately. Can you open the PR with this?

qstokkink commented 6 years ago

@devos50 sure, right now all of my attention is focused on #287 though.