os.system calls to other modules
crashfrog opened this issue · comments
Hi guys,
This:
os.system("python2.7 "+dirpath+"/libs/mapping_and_assembly_hybrid.py H_and_O_and_specific_genes.fasta "+mapping_mode+" "+str(threads)+" "+fnameA+" "+fnameB)
is an, um, surprising way to call Python modules from within a Python script. Is there a reason you're not simply import
ing the other modules? For starters, this makes you needlessly dependent on old versions of Python; it's also extremely fragile and non-standard; lastly it's almost totally incompatible with the Python packaging ecosystem. (As a bonus, subprocess.check_call
is quite a bit preferable to os.system
for making subshell calls, but there's never a need to subshell-call Python from Python.)
Would you accept a PR that addressed some of these issues?
Justin Payne
Bioinformatician
US Food and Drug Administration
Hi Justin,
Thanks for your suggestions. I am an amateur programmer who learned python all by myself. I know that there are many unprofessional parts in my code. It would be great that you are willing to help me to fix it.
Yes, we will accept a PR to address those issues.
Regards,
Shaokang
Cool, no sweat. I'll fork the repo and have a PR for you later this week. I'll try to annotate the changes I'm making in the commit messages and comments.
Thanks!
@hcdenbakker where is your version?
@tseemann Here it is: https://github.com/hcdenbakker/SeqSero2. Not something I have actively worked recently.