jel
として実行可能なjel
というコマンドを作成しました。 Pythonで動作し、jel doctor
を実行すると、jel.py
にエラー(メインファイル)が表示されます。コードは次のようになります。必要なモジュールはすべてインポート済みです。cdディレクトリが存在しませんか?
elif arg == 'doctor':
subprocess.call(['cd', 'js'])
ver = subprocess.call(['node', 'version.js'])
subprocess.call(['cd', '..'])
if not ver == version:
print 'jel doctor: \033[91found that version\033[0m ' + str(version) + ' \033[91mis not the current version\033[0m'
print 'jel doctor: \033[92mrun jel update\033[0m'
sys.exit()
js
ファイルversion.js
は、ノード上で実行され、次のようになりますさ:必要なすべてのパッケージはjel.py
ファイルを呼び出すためにsubprocess
を使用する場合、それは私にこのエラーを与えている
var latest = require('latest');
latest('jel', function(err, v) {
console.log(v);
// => "0.0.3"
if (err) {
console.log('An error occurred.');
}
});
をインストールされていますcs js
およびnode version.js
:
Traceback (most recent call last):
File "/bin/jel", line 90, in <module>
subprocess.call(['cd', 'js'])
File "/usr/lib/python2.7/subprocess.py", line 522, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
bjskistad:~/workspace (master) $ jel doctor
Traceback (most recent call last):
File "/bin/jel", line 90, in <module>
subprocess.call(['cd', 'js'])
File "/usr/lib/python2.7/subprocess.py", line 522, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
私はディレクトリが存在しないと言っていると思いますが、それはあります。それ以前に別のものを呼び出す必要がありますか?
いいえ、 'cd'ファイルが存在しないと言っています。 'cd'はシェルであり、実行可能ファイルではありません。 –
@Robᵩはい、 'js'ディレクトリが見つけられ、' version.js'はノードによって実行されるべきです。 –
@RobᵩPlus、私はそれを私のbashで走らせ、それは働いた。 –