同僚が Python のインストールで問題を抱えています。以下のコードを実行すると、現在の作業ディレクトリの代わりに from'C:\my\folder\'
が'C:\'
返されます。私または他の誰かが私たちのシステムでスクリプトを実行すると、'C:\my\folder\'
.
一部のグローバル設定が問題の原因であると想定しているため、Python をアンインストールし、ローカルの Python2.7 フォルダーを削除し、レジストリを消去して Python を再インストールしてもらいましたが、まだ機能していません。
注: 多数のレガシー スクリプトがあるため、subprocess を使用するようにそれらすべてを修正することは現実的ではありません。:(
何か案は?
環境: Windows XP、Python 2.7
import os
#
# This test script demonstrates issue on the users computer when python invokes
# a subshell via the standard os.system() call.
#
print "This is what python thinks the current working directory is..."
print os.getcwd()
print
print
print "but when i execute a command *from* python, this is what i get for the current working directory"
os.system('echo %cd%')
raw_input()