Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

file not found error in abspath #47

Closed
martinschorb opened this issue Apr 1, 2022 · 2 comments
Closed

file not found error in abspath #47

martinschorb opened this issue Apr 1, 2022 · 2 comments

Comments

@martinschorb
Copy link
Contributor

Hi,

in just one CI environment I run into a file not found error in os.path.abspath:

/opt/conda/lib/python3.7/site-packages/mobie/image_data.py:87: in add_bdv_image
    data_path = bdv_metadata.get_data_path(xml_path, return_absolute_path=True)
/opt/conda/lib/python3.7/site-packages/pybdv/metadata.py:845: in get_data_path
    path = os.path.abspath(os.path.relpath(path))
/opt/conda/lib/python3.7/posixpath.py:475: in relpath
    start_list = [x for x in abspath(start).split(sep) if x]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
path = '.'
    def abspath(path):
        """Return an absolute path."""
        path = os.fspath(path)
        if not isabs(path):
            if isinstance(path, bytes):
                cwd = os.getcwdb()
            else:
>               cwd = os.getcwd()
E               FileNotFoundError: [Errno 2] No such file or directory
/opt/conda/lib/python3.7/posixpath.py:383: FileNotFoundError

Doing some research, I found that if CWD is deleted during the call, it can cause this behaviour in certain combinations in a python environment.

conda/conda#6584
pytest-dev/pytest-cov#306

I cannot really understand what is going on, because the error does NOT show up neither in my dev environment nor in my docker that I use to mimic the CI scenario. There, the tests run just fine.
Only on the Gitlab CI, I run into this error.
I also tried forcing certain conda or pytest versions without success.

Do you think that there is potential confusion for CWD by some cd calls somewhere in mobie or pybdv.metadata that we could change to avoid running into this scenario?

@constantinpape
Copy link
Owner

Do you think that there is potential confusion for CWD by some cd calls somewhere in mobie or pybdv.metadata that we could change to avoid running into this scenario?

No, neither mobie nor pybdv.metadata do any os.chdir or similar directory changing. This looks like an issue with your CI set-up that's not connected to pybdv. I would recommend to either deactivate that setting or mark the corresponding test as expected failure for it.

@martinschorb
Copy link
Contributor Author

martinschorb commented Apr 1, 2022

OK, that's what I expected. I really have no idea what's going on.
Unfortunately the mobie.add_image call is the core of the procedure I like to test.
Fingers crossed that there is some solution on the CI side for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants