python3.6/tempfile.py", line 483, in func_wrapper return func(

Traceback (most recent call last):
  File "cocoEvalCapDemo.py", line 56, in <module>
    cocoEval.evaluate()
  File "/storage/st2/image_caption/coco-caption/pycocoevalcap/eval.py", line 54, in evaluate
    score, scores = scorer.compute_score(gts, res)
  File "/storage/st2/image_caption/coco-caption/pycocoevalcap/spice/spice.py", line 54, in compute_score
    json.dump(input_data, in_file, indent=2)
  File "/storage/st2/anaconda33/lib/python3.6/json/__init__.py", line 180, in dump
    fp.write(chunk)
  File "/storage/st2/anaconda33/lib/python3.6/tempfile.py", line 483, in func_wrapper
    return func(*args, **kwargs)
TypeError: a bytes-like object is required, not 'str'

源码

 out_file = tempfile.NamedTemporaryFile(delete=False, dir=temp_dir )

改为

 out_file = tempfile.NamedTemporaryFile(delete=False, dir=temp_dir, mode='w')

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
ERROR: Exception: Traceback (most recent call last): File "/usr/lib/python3.6/shutil.py", line 550, in move os.rename(src, real_dst) PermissionError: [Errno 13] Permission denied: '/usr/lib/python3/dist-packages/numpy' -> '/tmp/pip-uninstall-i14esy8v' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/daxigua/.local/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 164, in exc_logging_wrapper status = run_func(*args) File "/home/daxigua/.local/lib/python3.6/site-packages/pip/_internal/commands/uninstall.py", line 99, in run verbose=self.verbosity > 0, File "/home/daxigua/.local/lib/python3.6/site-packages/pip/_internal/req/req_install.py", line 671, in uninstall uninstalled_pathset.remove(auto_confirm, verbose) File "/home/daxigua/.local/lib/python3.6/site-packages/pip/_internal/req/req_uninstall.py", line 384, in remove moved.stash(path) File "/home/daxigua/.local/lib/python3.6/site-packages/pip/_internal/req/req_uninstall.py", line 282, in stash renames(path, new_path) File "/home/daxigua/.local/lib/python3.6/site-packages/pip/_internal/utils/misc.py", line 307, in renames shutil.move(old, new) File "/usr/lib/python3.6/shutil.py", line 562, in move rmtree(src) File "/usr/lib/python3.6/shutil.py", line 486, in rmtree _rmtree_safe_fd(fd, path, onerror) File "/usr/lib/python3.6/shutil.py", line 424, in _rmtree_safe_fd _rmtree_safe_fd(dirfd, fullname, onerror) File "/usr/lib/python3.6/shutil.py", line 424, in _rmtree_safe_fd _rmtree_safe_fd(dirfd, fullname, onerror) File "/usr/lib/python3.6/shutil.py", line 444, in _rmtree_safe_fd onerror(os.unlink, fullname, sys.exc_info()) File "/usr/lib/python3.6/shutil.py", line 442, in _rmtree_safe_fd os.unlink(name, dir_fd=topfd) PermissionError: [Errno 13] Permission denied: 'test_linalg.py'
05-30
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值