-2

Looking at https://github.com/NVIDIA/TensorRT/blob/main/samples/python/introductory_parser_samples/onnx_resnet50.py

There is this code: sys.path.insert(1, os.path.join(sys.path[0], "..")) which inserts the same working directory with 2 dots to the sys.path list:

  ['/home/pran/Downloads/workingdirectory', 
'/home/pran/Downloads/workingdirectory/..', 
'/usr/lib/python36.zip', '/usr/lib/python3.6']

If the working directory is already in the list then I should be able to access that directory already. So what difference does the two dots make?

Thanks in Advance!

user13174343
  • 235
  • 2
  • 10
  • 1
    `..` -> parent. It adds the parent of the working directory to the path. Resolving the absolute paths happen at runtime. – rdas Nov 21 '21 at 12:28

1 Answers1

1

It's adding the parent directory.

As a general rule of thumb .. points to the parent of the directory.

Tamir
  • 1,224
  • 1
  • 5
  • 18