bioscrape
bioscrape copied to clipboard
ModuleNotFoundError when importing bioscrape from inside bioscrape directory.
MWE to produce this error:
>> cd bioscrape/
>> python
>> import bioscrape
'Module not found error bioscrape.random not found'
(this is an error in __init__.py)
As this error only occurs when importing from the root directory (which no one should do, ideally), but people end up creating their files in this root directory sometimes and end up with this error. If this was a pure python package, this error wouldn't exist but bioscrape import statements work from the compiled version only (i.e. the installed package in sites-packages).
What could be a good way to solve this issue? One way is to simply issue a warning or an error if someone tries to import bioscrape from the root directory (they should not be doing this). The other way is to some how force all the imports to look at sites-packages by default.
Any ideas @sclamons @WilliamIX ?
@ayush9pandey I think an error or warning would be fine, maybe in init of the package?
Yes, but how do we detect that the user is inside the directory? There must be a way tho, I didn't look closely for a solution. But if it can be done, cleanly we should do it
Adding the package to src/
will solve this issue. Most other python packages do this, and it is probably the correct packaging practice.
Fixed in documentation
#165