Rhino Compute fails to load external file

Hi!
I’ve been implementing a short python script component that gets a relative path and turns it into an absolute path (see definition below).

import sys
import os

parent_folder_path = os.path.dirname(os.path.dirname(ghdoc.Path))
filepath = str(parent_folder_path) + "\\sourcefiles\\my_sample.ifc"
print(filepath)

This enables me to load an external IFC in my Grasshopper script. When i do so with my GUI it works fine and my script is able to load the file and execute what i want.
The thing is, when i try to do so with my local Rhino Compute instance, i get the feeling that my Python script is not processed and i get this:

Error running script: expected str, bytes or os.PathLike object, not NoneType [4:1]: component "Python 3 Script"

image

Do you have any idea how i can solve this? Thanks in advance!