0

I have cloned a git repo, and it is now local on my machine. Inside the path Pipes/Filtering there is a script called filter_pileup_by_site_list.py which I am trying to use, it's a docopt CLI so i'm going to the directory I have mentioned above and type the following in the terminal : python filter_pileup_by_site_list.py Filter_pileup_by_site <parameters>
The script imports a class from another directory in the repo which its path is: Pipes/Utility.
The command I have written above fails and returns the following error:

  File "filter_pileup_by_site_list.py", line 16, in <module>
    from Utility.Pileup_class import Pileup_line
ModuleNotFoundError: No module named 'Utility'

All the solutions I came across were related to PYTHONPATH so I edited it, now when I type in the terminal echo $PYTHONPATH i get /Pipes:/Pipes/Utility:/Pipes/Filtering:/Pipes/:/Bigdata/bioinf/Pipes3:/Bigdata/bioinf/Pipes:/Bigdata/users/eliran/Pipes
And it still returns the exact backtrace I had before.

If it does matter somehow, I'm using linux mint.

Eliran Turgeman
  • 1,526
  • 2
  • 16
  • 34

1 Answers1

0

Solution that worked for:

add these lines at the top of the script:

import sys  
sys.path.insert(1, 'path/to/another/directory')

The following works because as default python looks for files only in the local folder so I had to add the above line to tell it to search in the previous folder so it can find Utility folder.

Eliran Turgeman
  • 1,526
  • 2
  • 16
  • 34