Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSONDecodeError("Expecting value", s, err.value) from None #63

Open
falahtech opened this issue Apr 26, 2024 · 1 comment
Open

JSONDecodeError("Expecting value", s, err.value) from None #63

falahtech opened this issue Apr 26, 2024 · 1 comment

Comments

@falahtech
Copy link

When I run command python3 erpnext_sync.py its showing below error.

Traceback (most recent call last):
File "/home/sigma/frappe-bench/biometric-attendance-sync-tool/erpnext_sync.py", line 319, in
status = pickledb.load('/'.join([config.LOGS_DIRECTORY, 'status.json']), True)
File "/home/sigma/frappe-bench/biometric-attendance-sync-tool/venv/lib/python3.10/site-packages/pickledb.py", line 43, in load
return PickleDB(location, auto_dump, sig)
File "/home/sigma/frappe-bench/biometric-attendance-sync-tool/venv/lib/python3.10/site-packages/pickledb.py", line 54, in init
self.load(location, auto_dump)
File "/home/sigma/frappe-bench/biometric-attendance-sync-tool/venv/lib/python3.10/site-packages/pickledb.py", line 85, in load
self._loaddb()
File "/home/sigma/frappe-bench/biometric-attendance-sync-tool/venv/lib/python3.10/site-packages/pickledb.py", line 102, in _loaddb
self.db = json.load(open(self.loco, 'rt'))
File "/usr/lib/python3.10/json/init.py", line 293, in load
return loads(fp.read(),
File "/usr/lib/python3.10/json/init.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

@suhailmdcse
Copy link

suhailmdcse commented Sep 10, 2024

with open("/path/to/file_name.json", 'ar+') as f:
        param_json = json.load(f)

The mode 'ar+' is not valid in Python 3. In Python 3, valid modes for the open() function include:

'r': read
'w': write (overwriting the file)
'a': append
'b': binary mode
'+': update (read/write)
with open("/path/to/file_name.json", 'a+') as f:
        param_json = json.load(f)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants