小编Shr*_*lla的帖子

nodejs exec命令失败,没有有用的错误消息

这是要执行的代码



    cp.exec("cc -Wall /tmp/test.c -o /tmp/test", function(e, stdout, stderr) {
        if (e) {
            var errorstr = "Compilation failed with the following error
"+ e.message.toString() client.send(errorstr) console.log(e, stdout, stderr) ee.prototype.removeAllListeners() } else if (stderr.length > 0) { client.send("Compilion finished with warnings\n"+ stderr + '\n') client.send('compiled') ee.prototype.emit('compiled') } else { client.send("Compilation successful") ee.prototype.emit('compiled') } })
Run Code Online (Sandbox Code Playgroud)

'client'是socket.io的回调参数的参数.'ee'是EventEmitter的一个实例

来了问题.在运行代码时,回调表明该命令不成功.console.log(e,stdout,stderr)是

{ [Error: Command failed: ] killed: false, code: false, signal: undefined } '' ''

/tmp/test.c是一个有效的C代码以及检查目录/ tmp,我发现test.c的是适当的和二进制"测试" 生成并在上壳运行,则适当地执行.所以我不明白为什么它会导致执行不成功.错误对象的信息也没有用.希望得到一些帮助/解释

javascript exec child-process node.js

11
推荐指数
1
解决办法
9340
查看次数

无法导入名称SIGNATURE_HMAC

我正在运行python-social-auth提供的django示例,并且收到以下500服务器错误.

ImportError at /login/bitbucket/
cannot import name SIGNATURE_HMAC
Request Method: GET
Request URL:    http://localhost:8000/login/bitbucket/
Django Version: 1.4.4
Exception Type: ImportError
Exception Value:    
cannot import name SIGNATURE_HMAC
Exception Location: /usr/local/lib/python2.7/dist-packages/requests_oauthlib/core.py in  <module>, line 3
Python Executable:  /usr/bin/python
Python Version: 2.7.3
Run Code Online (Sandbox Code Playgroud)

我在Google和StackOverflow中搜索过,无法找到任何答案.我刚刚克隆了它,并没有改变任何代码.我安装了hashlib和hmac库

[编辑]我升级了oauthlib和requests_oauthlib,错误被新的替换

AttributeError at /login/bitbucket/
'Request' object has no attribute 'body'
Request Method: GET
Request URL:    http://localhost:8000/login/bitbucket/
Django Version: 1.4.4
Exception Type: AttributeError
Exception Value:    
'Request' object has no attribute 'body'
Exception Location: /usr/local/lib/python2.7/dist-packages/requests_oauthlib/core.py in         __call__, line …
Run Code Online (Sandbox Code Playgroud)

python django hmac importerror python-2.7

5
推荐指数
1
解决办法
735
查看次数