wardbradt / peregrine

Detects arbitrage opportunities across 131 cryptocurrency exchanges in 50 countries
MIT License
1.19k stars 338 forks source link

The imports are really screwy ... so I fixed them with examples of both correct ways of handling this #7

Closed chromakey-io closed 6 years ago

chromakey-io commented 6 years ago

Hey,

So you either want to use relative import paths like ... "from .utils import *" .... The "." translates to the directory the file is located in. If you don't include a "." it uses paths relative to where you are executing things from which can vary .... As it is, "import peregrine" will fail if you try to import it as a module and the only way to use things is if you are running all of the files from within the peregrine directory.

The other way to handle this is to simply type out the explicit path .... so "from peregrine.utils.what-ever import what-ever" ... always including the full path which means your module name as well as what-ever sub-module.

Obv. the easier way is to just use the "." system .... but it tends to confuse newbs .... so pick your poison.