Skip to content

Enhance _exec_cmd function to improve error handling and output collection#36

Merged
flarco merged 2 commits intoslingdata-io:mainfrom
axellpadilla:56-stdout-on-error-exec-cmd
Oct 13, 2025
Merged

Enhance _exec_cmd function to improve error handling and output collection#36
flarco merged 2 commits intoslingdata-io:mainfrom
axellpadilla:56-stdout-on-error-exec-cmd

Conversation

@axellpadilla
Copy link
Copy Markdown
Contributor

fixes #35

@flarco
Copy link
Copy Markdown
Contributor

flarco commented Oct 11, 2025

thanks @axellpadilla , I checked out the branch on my local machine and ran python -m pytest tests/tests.py -v, got this error:

$ python -m pytest tests/tests.py -v
=============================================================================== test session starts ================================================================================
platform darwin -- Python 3.11.8, pytest-8.3.4, pluggy-1.5.0 -- /Users/fritz/.local/share/virtualenvs/sling-python-G4ZuZLzI/bin/python
cachedir: .pytest_cache
rootdir: /Users/fritz/__/Git/sling-python/sling
plugins: anyio-4.3.0
collected 0 items / 1 error                                                                                                                                                        

====================================================================================== ERRORS ======================================================================================
_________________________________________________________________________ ERROR collecting tests/tests.py __________________________________________________________________________
../../../../.local/share/virtualenvs/sling-python-G4ZuZLzI/lib/python3.11/site-packages/_pytest/python.py:493: in importtestmodule
    mod = import_path(
../../../../.local/share/virtualenvs/sling-python-G4ZuZLzI/lib/python3.11/site-packages/_pytest/pathlib.py:587: in import_path
    importlib.import_module(module_name)
/opt/homebrew/Cellar/python@3.11/3.11.8/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1204: in _gcd_import
    ???
<frozen importlib._bootstrap>:1176: in _find_and_load
    ???
<frozen importlib._bootstrap>:1147: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:690: in _load_unlocked
    ???
../../../../.local/share/virtualenvs/sling-python-G4ZuZLzI/lib/python3.11/site-packages/_pytest/assertion/rewrite.py:184: in exec_module
    exec(co, module.__dict__)
tests/tests.py:6: in <module>
    from sling import (
E     File "/Users/fritz/__/Git/sling-python/sling/sling/__init__.py", line 527
E       raise Exception(f"Sling command failed:\n{'\n'.join(lines)}")
E                                                                   ^
E   SyntaxError: f-string expression part cannot include a backslash
============================================================================= short test summary info ==============================================================================
ERROR tests/tests.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
================================================================================= 1 error in 0.17s =================================================================================

@axellpadilla
Copy link
Copy Markdown
Contributor Author

@flarco , got it, python 3.11 doesn't support it, I tested with python 3.9, 3.10, 3.11 and fixed compatibility now

@flarco flarco merged commit 121f80f into slingdata-io:main Oct 13, 2025
@flarco
Copy link
Copy Markdown
Contributor

flarco commented Oct 13, 2025

Thanks 👍

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

Successfully merging this pull request may close these issues.

Include exception in "Sling command failed" exceptions for easier debugging

2 participants