ops icon indicating copy to clipboard operation
ops copied to clipboard

The cwd variable does not take effect

Open leeyiding opened this issue 7 months ago • 0 comments

Sometimes the main file of a python program does not have to be placed in the root directory, but organizes all the code files into one directory, so the path to the working directory needs to be modified, but I found that the cwd variable does not take effect.

I made a minimal replica code here. tree

.
├── config.json
└── program
    └── main.py

2 directories, 2 files

config.json

{
    "Dirs": [
        "program"
    ],
    "Args":[
        "/program/main.py"
    ],
    "ManifestPassthrough": {
        "cwd": "/program"
    }
}

main.py

import os

current_directory = os.getcwd()
print(current_directory)

run ops pkg load eyberg/python:3.10.6 -c config.json

warning: overwriting existing file /program/main.py hostpath old: program/main.py new: /root/nanos/test-cwd//program/main.py
running local instance
booting /root/.ops/images/python3.10 ...
en1: assigned 10.0.2.15
/

You can see that the program output '/' instead of '/program' as I expected. I don't know if the cwd variable is not effective or if my configuration or understanding is wrong.

leeyiding avatar Jun 28 '24 11:06 leeyiding