Closed fennerm closed 5 years ago
Hi fennerm,
you are completely right. The way I implemented it is kinda sloppy ...
Thank you very much for your pull request! I appreciate the effort but I can still see a problem arising from the the use of different python versions in virtualenvs/condas (your code would not run on our local compute cluster) ... so I would propose to code it the following way
if __name__ == '__main__':
args = docopt(__doc__,
version=__version__,
options_first=True)
argv = [args['<command>']] + args['<args>']
if args['<command>'] == 'create':
exit(call([LIBDIR + '/create.py'] + argv))
elif args['<command>'] == 'view':
exit(call([LIBDIR + '/view.py'] + argv))
elif args['<command>'] == 'blobplot' or args['<command>'] == 'plot':
argv[0] = "blobplot"
exit(call([LIBDIR + '/blobplot.py'] + argv))
elif args['<command>'] == 'map2cov':
exit(call([LIBDIR + '/map2cov.py'] + argv))
elif args['<command>'] == 'covplot' or args['<command>'] == 'comparecov'
argv[0] = "covplot"
exit(call([LIBDIR + '/covplot.py'] + argv))
elif args['<command>'] == 'seqfilter':
exit(call([LIBDIR + '/seqfilter.py'] + argv))
elif args['<command>'] == 'taxify':
exit(call([LIBDIR + '/taxify.py'] + argv))
elif args['<command>'] == 'bamfilter':
exit(call([LIBDIR + '/bamfilter.py'] + argv))
elif args['<command>'] == 'nodesdb':
exit(call([LIBDIR + '/nodesdb.py'] + argv))
else:
exit(call([os.path.join(MAINDIR, './blobtools'), '-h']))
Since the individual scripts are executable they will default to the ENV python which is that python that appears first in $PATH. Since virtualenv/ananaconda/etc put theirs in front, they would work well with it.
Do you see an issue with this for your setup?
cheers,
dom
Unfortunately I don't think this would solve the issue if python resolves to python3 by default. This becomes a problem when a pipeline also contains tasks which rely on python3. Switching virtual envs in the middle of a script seems wrong to me but maybe thats the best option.
Can you see a problem with using sys.executable so that at least 'python2 blobtools.py ...' would work?
Have this issue as well can no get blobtools to install.
Will be fixed in next release.
cheers,
dom
Our system is setup with python 2.7 and python 3.6, but defaults to python 3.6.
Attempting to run blobtools with python2 leads to SyntaxErrors since the main script calls its submodules using generic python. Swapping all instances of 'python' to 'python2' in blobtools.py fixes this for me, but perhaps there is a better solution.