-3

I'm working in google colab and trying to run a python file (let's call it B) and get this:

Traceback (most recent call last): File "run_sem_seg_penumothorax.py", line 5, in <module> import step.make_sem_seg_lables_pneumothorax as make_sem_seg_lables_pneumothorax

I am in a mother directory, let's call it A. This is how it's organised:

  1. I'm in cd A
  2. -B is a file that I'm trying to run
  3.   -STEP is a directory in A
    
  4.          make_sem..... is a file in directory A/STEP
    

For some reason my colab notebook doesn't pull this file from the step folder and I don't know how to resolve it. I was trying to edit my file B and do something like this:

import 'google drive directory:/step.make_sem_seg_lables_pneumothorax' as make_sem_seg_lables_pneumothorax ModuleNotFoundError: No module named 'step.make_sem_seg_lables_pneumothorax'

Sadly, didn't work.

  1. Do I have to edit the file?
  2. If so, how to do it?
  3. I see in all githubs that they name files this way mother_folder.daughter_file so I guess it works in their cases. Why doesn't it work for me?

Thank you, Joanna

1 Answers1

0

I'm confused trying to understand how the folders are organized. Is this how the directory structure looks?

A
├── B.py
└── STEP
    └── make_sem.py


EDIT:
Ok, now what version of python are you running? If it is less than Python3.3, you'll need to add an input.py file in the STEP directory like this: (see What is __init__.py for?)

A
├── B.py
└── STEP
    ├── __init__.py
    └── make_sem.py

GandhiGandhi
  • 1,029
  • 6
  • 10