-
Notifications
You must be signed in to change notification settings - Fork 94
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 parsing: check for CWD existence #5694
Conversation
It looks like applying this diff won't actually help because $ mkdir foo
$ cd foo
$ cylc version
8.3.0.dev
$ rm -r ../foo
$ cylc version
Traceback (most recent call last):
...
Traceback (most recent call last):
File "~/mambaforge/envs/cylc-8.2.dev/bin/cylc", line 5, in <module>
from cylc.flow.scripts.cylc import main
File "~/cylc-flow/cylc/flow/scripts/cylc.py", line 26, in <module>
import pkg_resources
...
return os.path.normcase(os.path.realpath(os.path.normpath(_cygwin_patch(filename))))
File "~/mambaforge/envs/cylc-8.2.dev/lib/python3.9/posixpath.py", line 393, in realpath
return abspath(path)
File "~/mambaforge/envs/cylc-8.2.dev/lib/python3.9/posixpath.py", line 380, in abspath
cwd = os.getcwd()
FileNotFoundError: [Errno 2] No such file or directory |
Yes that's what I found too (see the associated issue) - but @ColemanTom claims it works in his environment, which would be some kind of an improvement. Can you comment Tom? |
|
cylc version also works for me with this change.
|
What is your PYTHONPATH? There is a detailed discussion here about this issue. If you have a trailing or leading
|
Other comment, based on the above output, pkg_resources is deprecated. Can |
Strange.
Unset (I don't use PYTHONPATH) I would expect any difference in behaviour is likely down to Python version
Note we still support Python 3.7 and will need to continue to support it for a while to come. |
Installing matching versions to yours, and I don't get failures whether I run a script or do I should perhaps note, it works for me on two completely different platforms, one an HPC login node, an another a VM, maintained by completely different organisations. |
I've matched your versions but cannot get this to succeed on two different vms and three different filesystems, I'm really not sure what the difference is here, possible OS/FS. |
There's no harm in us accepting this change, however, it doesn't look like this is behaviour you can rely on (especially as we cannot reproduce your results so cannot test this) as it may be OS/FS specific so sanitising working practices to avoid chopping off the branch you're standing on is going to be the safer option. I'm surprised that more commands don't fail under these circumstances as a wide range of filesystem operations are going to fail. |
OK I've clarified and commented the code, and added a unit test. @oliver-sanders - can you do a quick review and merge it? |
Close #5688
But note #5688 (comment)
Is it worth doing this?
Check List
CONTRIBUTING.md
and added my name as a Code Contributor.setup.cfg
(andconda-environment.yml
if present).CHANGES.md
entry included if this is a change that can affect users?.?.x
branch.