理解Python错误消息并解决

时间:2013-05-15 13:58:57

标签: python

我不是Python程序员,但make脚本使用的是Python。在这里我得到了这个错误信息,我可以看到堆栈跟踪。但是如何从这里跟踪问题?

/usr/bin/python2.7 ./config/pythonpath.py -I./config ./config/expandlibs_exec.py --depend .deps/libjs_static.a.pp --target libjs_static.a --extract -- /usr/local/bin/ar cr libjs_static.a bignum-dtoa.o bignum.o cached-powers.o diy-fp.o double-conversion.o fast-dtoa.o fixed-dtoa.o strtod.o jsalloc.o jsanalyze.o jsapi.o jsarray.o jsatom.o jsbool.o jsclone.o jscntxt.o jscompartment.o jsdate.o jsdbgapi.o jsdhash.o jsdtoa.o jsexn.o jsfriendapi.o jsfun.o jsgc.o jscrashreport.o jsinfer.o jsinterp.o jsiter.o jslog2.o jsmath.o jsmemorymetrics.o jsnativestack.o jsnum.o jsobj.o json.o jsonparser.o jsopcode.o jsproxy.o jsprf.o jsprobes.o jspropertycache.o jspropertytree.o jsreflect.o jsscope.o jsscript.o jsstr.o jstypedarray.o jsutil.o jswatchpoint.o jsweakmap.o jsworkers.o jswrapper.o jsxml.o prmjtime.o sharkctl.o ArgumentsObject.o ScopeObject.o Debugger.o GlobalObject.o ObjectImpl.o Stack.o String.o BytecodeCompiler.o BytecodeEmitter.o FoldConstants.o NameFunctions.o ParallelArray.o ParseMaps.o ParseNode.o Parser.o SPSProfiler.o TokenStream.o TestingFunctions.o Profilers.o LifoAlloc.o Eval.o MapObject.o RegExpObject.o RegExpStatics.o RegExp.o Marking.o Memory.o Statistics.o StoreBuffer.o StringBuffer.o Unicode.o Xdr.o ExecutableAllocator.o PageBlock.o YarrInterpreter.o YarrPattern.o YarrSyntaxChecker.o YarrCanonicalizeUCS2.o ExecutableAllocatorPosix.o OSAllocatorPosix.o jsperf.o pm_stub.o HashFunctions.o SHA1.o
Traceback (most recent call last):
  File "./config/pythonpath.py", line 56, in <module>
    main(sys.argv[1:])
  File "./config/pythonpath.py", line 48, in main
    execfile(script, frozenglobals)
  File "./config/expandlibs_exec.py", line 322, in <module>
    main()
  File "./config/expandlibs_exec.py", line 311, in main
    ret = subprocess.call(args)
  File "/usr/lib/python2.7/subprocess.py", line 493, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory
make[1]: *** [libjs_static.a] Error 1
make[1]: Leaving directory `/priv

1 个答案:

答案 0 :(得分:1)

第一步是查看源代码; Python打印文件名和行号:File "/usr/lib/python2.7/subprocess.py", line 1249

当你看到那里时,你会看到一些代码。接下来的步骤是找出每个变量的分配位置(即谁设置child_exception),然后执行此代码所需的内容,直到您到达代码与您提供的内容一起工作的地方(这遵循假设Python库可能是正确的并且你犯了一个错误。)

在您的特定情况下,问题很可能是args[0]包含指向不存在的文件/可执行文件的路径。

请检查./config/expandlibs_exec.py的位置,第311行获取args以及args[0]内的内容