Tag: getcwd

shell初始化问题,当点击标签时,getcwd有什么问题?

一旦我点击bash上的标签,错误信息会出现,怎么了? symlink-hook: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory symlink-hook: error retrieving current directory: getcwd: cannot access parent directories: Success symlink-hook: error retrieving current directory: getcwd: cannot access parent directories: Success symlink-hook: error retrieving current directory: getcwd: cannot access parent directories: Success symlink-hook: error retrieving current directory: getcwd: […]

sh:0:getcwd()失败:引用的驱动器上没有这样的文件或目录

我正在尝试在Ubuntu 12中编译ARM代码。 当我把代码放在本地目录中时,一切正常。 但是当我把代码放在引用的挂载目录下时出现错误: making testXmlFiles sh: 0: getcwd() failed: No such file or directory ARM Compiling xxxxx.c sh: 0: getcwd() failed: No such file or directory 这是我在fstab中的设置 //10.0.0.1/data /mnt/data cifs auto,noserverino,credentials=/root/.smbcredentials,file_mode=0777,dir_mode=0777,uid=user,gid=users,noperm 0 0 这里发生了什么? 什么可能导致这个错误?

我如何findPython的脚本目录?

考虑下面的Python代码: import os print os.getcwd() 我使用os.getcwd()来获取脚本文件的目录位置 。 当我从命令行运行脚本时,它给了我正确的path,而当我从Django视图中的代码运行的脚本运行它时,它会打印/ 。 如何从Django视图运行的脚本中获取脚本的path? 更新: 总结到目前为止的答案 – os.getcwd()和os.path.abspath()都给当前的工作目录,可能或不可能是脚本所在的目录。 在我的网站主机设置__file__只给出没有path的文件名。 Python中没有任何方法可以(总是)能够接收脚本所在的path吗?