gpt4 book ai didi

python - 重定向到不存在的文件目录

转载 作者:太空宇宙 更新时间:2023-11-03 12:07:02 24 4
gpt4 key购买 nike

我在 Python 中调用这个命令:

os.system('echo %s  > `find $HOME -iname p410.yaml`' % string)

这在 OSX 上运行良好,但在 Ubuntu 上给我 /home/path/to/p410.yaml: Directory nonexistent。但是,我可以用 vim 在它给我的路径上编辑文件。

知道怎么回事吗?

编辑

统计输出 find $HOME -iname p410.yaml

File: `/home/aslab/chris_ws/src/pulseon_p400/config/p410.yaml'
Size: 124 Blocks: 8 IO Block: 4096 regular file
Device: 805h/2053d Inode: 460669 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 1001/ aslab) Gid: ( 1001/ aslab)
Access: 2014-12-22 13:45:57.000000000 +1000
Modify: 2014-12-22 13:44:45.000000000 +1000
Change: 2014-12-22 13:44:45.000000000 +1000
Birth: -
File: `/home/aslab/uwb_ws/src/pulseon_p400/launch/p410.yaml'
Size: 163 Blocks: 8 IO Block: 4096 regular file
Device: 805h/2053d Inode: 457183 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 1001/ aslab) Gid: ( 1001/ aslab)
Access: 2014-12-19 08:11:30.000000000 +1000
Modify: 2014-09-12 14:37:19.000000000 +1000
Change: 2014-09-12 14:37:19.000000000 +1000
Birth: -

最佳答案

这里的问题是有两个同名的文件,通过 Python 解释器过滤的错误消息有点模糊。老实说,我也很惊讶,当我调用 vim 'find $HOME -iname p410.yaml' 时,当有两个打开文件的选项时它起作用了。

关于python - 重定向到不存在的文件目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27596358/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com