osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem


On 7/20/2017 3:19 PM, Hongze Liu wrote:
> Hello Python,
> 
> I encountered this problem:
>   File "C:\Users\Hongze\AppData\Local\Programs\python\Python36\lib\runpy.py",
> line 193, in _run_module_as_main
>      "__main__", mod_spec)
>    File "C:\Users\Hongze\AppData\Local\Programs\python\Python36\lib\runpy.py",
> line 85, in _run_code
>      exec(code, run_globals)
>    File "ok\__main__.py", line 46, in <module>
>    File "ok\client\cli\ok.py", line 201, in main
>    File "ok\client\protocols\rate_limit.py", line 41, in run
>    File "ok\client\utils\storage.py", line 28, in get
>    File "ok\client\utils\storage.py", line 18, in contains
>    File "C:\Users\Hongze\AppData\Local\Programs\python\Python36\lib\shelve.py",
> line 243, in open
>      return DbfilenameShelf(filename, flag, protocol, writeback)
>    File "C:\Users\Hongze\AppData\Local\Programs\python\Python36\lib\shelve.py",
> line 227, in __init__
>      Shelf.__init__(self, dbm.open(filename, flag), protocol, writeback)
>    File "C:\Users\Hongze\AppData\Local\Programs\python\Python36\lib\dbm\__init__.py",
> line 94, in open
>      return mod.open(file, flag, mode)
>    File "C:\Users\Hongze\AppData\Local\Programs\python\Python36\lib\dbm\dumb.py",
> line 324, in open
>      return _Database(file, mode, flag=flag)
>    File "C:\Users\Hongze\AppData\Local\Programs\python\Python36\lib\dbm\dumb.py",
> line 71, in __init__
>      self._update()
>    File "C:\Users\Hongze\AppData\Local\Programs\python\Python36\lib\dbm\dumb.py",
> line 106, in _update
>      key, pos_and_siz_pair = _ast.literal_eval(line)
>    File "C:\Users\Hongze\AppData\Local\Programs\python\Python36\lib\ast.py",
> line 48, in literal_eval
>      node_or_string = parse(node_or_string, mode='eval')
>    File "C:\Users\Hongze\AppData\Local\Programs\python\Python36\lib\ast.py",
> line 35, in parse
>      return compile(source, filename, mode, PyCF_ONLY_AST)
> ValueError: source code string cannot contain null bytes
> 
> 
> I attempted to reinstall python and used "Repair" option, however, the
> issue still exists.

Because the problem is with your code.  Somewhere in one of the files in 
your ok package passes a string or bytes containing \x00 to something 
that results in an attempt to compile the string.  Start with 
storage.py, contains(), line 18 and see what is being passed.  If needed 
work back up until you find the source of what is being passed.

-- 
Terry Jan Reedy