Install & Compatibility
Where this runs
tested against v1.0.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.010s · 17.8MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.5s · import 0.010s · 18MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
loads
✓ from sexpdata import loads
✗ import sexpdata; sexpdata.loads()
loads is a top-level function, not a method of the module; direct import is idiomatic.
dumps
✓ from sexpdata import dumps
✗ import sexpdata; sexpdata.dumps()
Same as loads.
Basic parsing and serialization of an S-expression string.
from sexpdata import loads, dumps
sexp_str = '(foo (bar 1 2) "string" nil)'
parsed = loads(sexp_str)
print(parsed) # Output: [Symbol('foo'), [Symbol('bar'), 1, 2], 'string', Symbol('nil')]
# Serialize back
sexp_out = dumps(parsed)
print(sexp_out) # Output: (foo (bar 1 2) "string" nil)
Errors
Common errors & fixes
AttributeError: module 'sexpdata' has no attribute 'loads'
Importing incorrectly (e.g., import sexpdata then sexpdata.loads). Actually loads is a top-level function; you must import it directly.
fixUse: from sexpdata import loads
ValueError: malformed S-expression at line 1
Input string is not properly formatted S-expression (e.g., missing closing parenthesis, stray characters).
fixEnsure the input is valid S-expression. Validate with a validator or use a try/except block.
TypeError: expected string or bytes-like object
Passing a non-string (e.g., integer) to loads().
fixConvert the argument to str: loads(str(my_var))
Upgrade
Version history
1.0.2latest on PyPI · released Jan 9, 2024
Audit
Dependencies
No dependency data recorded yet.