Skip to content

DataSources uses wrong path format if Python and DPF server run on different OS #2212

Open
@roosre

Description

@roosre

Before submitting the issue

  • I have checked for Compatibility issues
  • I have searched among the existing issues
  • I am using a Python virtual environment

Description of the bug

For instance, DataSources badly converts file paths if Python runs on Windows and uses a docker container (Linux).
The resulting error looks like this
Unable to open the following file: \tmp\dataProcessingTemp140674590562048\8e1b1b60-91d1-4772-bd3f-a90319753ab1\file.rst

but the path should have / (forward slashes).

The issue is caused by filepath = Path(filepath) with depends on the Python OS and not the OS of the server.
See core/data_sources.py line 162.

A simple fix (for windows) could look like this

filepath = Path(filepath)
if self._server.os == "posix":    
    filepath = filepath.as_posix() 

However, this should consider all combinations. I don't know if there are windows containers though.

Task: Update all calls Path(...) and handle the scenario where server and Python run on different OS.

Steps To Reproduce

Start DPF Container
Use PyDPF core on windows and connect to the container. Then, create a DataSources and print the result file paths

rst_file_path = "/tmp/dataProcessingTemp140674590562048/9026d379-52ed-4ce1-a8d5-133cd953c973/shell.rst"
rst_data_source = dpf.DataSources(rst_file_path)
rst_data_source.result_files

Which Operating System causes the issue?

Windows

Which DPF/Ansys version are you using?

DPF Server 2025.2.pre0

Which Python version causes the issue?

3.13

Installed packages

accessible-pygments==0.0.5
aiohappyeyeballs==2.6.1
aiohttp==3.11.14
aiosignal==1.3.2
alabaster==1.0.0
-e git+https://github.com/ansys/pydpf-composites.git@e2985f510ba791c411d405cc1e99779ddd05328b#egg=ansys_dpf_composites
ansys-dpf-core @ git+https://github.com/ansys/pydpf-core.git@1453403c76957981c84432cf67b43932ca9e99a5
ansys-sphinx-theme==1.3.3
anyio==4.9.0
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
astroid==3.3.9
asttokens==3.0.0
attrs==25.3.0
babel==2.17.0
beautifulsoup4==4.13.3
bleach==6.2.0
build==1.2.2.post1
cachetools==5.5.2
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
colorama==0.4.6
comm==0.2.2
contourpy==1.3.1
coverage==7.7.0
cycler==0.12.1
decorator==5.2.1
defusedxml==0.7.1
dill==0.3.9
distlib==0.3.9
docutils==0.21.2
executing==2.2.0
fastjsonschema==2.21.1
fatpack==0.7.8
filelock==3.18.0
fonttools==4.56.0
fqdn==1.5.1
frozenlist==1.5.0
google-api-core==2.24.2
google-api-python-client==2.165.0
google-auth==2.38.0
google-auth-httplib2==0.2.0
googleapis-common-protos==1.69.2
grpcio==1.71.0
httplib2==0.22.0
id==1.5.0
identify==2.6.9
idna==3.10
imagesize==1.4.1
importlib_metadata==8.6.1
iniconfig==2.1.0
ipython==8.34.0
ipywidgets==8.1.5
isoduration==20.11.0
isort==6.0.1
jaraco.classes==3.4.0
jaraco.context==6.0.1
jaraco.functools==4.1.0
jedi==0.19.2
Jinja2==3.1.6
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter-events==0.12.0
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.15.0
jupyter_server_proxy==4.4.0
jupyter_server_terminals==0.5.3
jupyterlab_pygments==0.3.0
jupyterlab_widgets==3.0.13
keyring==25.6.0
kiwisolver==1.4.8
markdown-it-py==3.0.0
MarkupSafe==3.0.2
matplotlib==3.10.1
matplotlib-inline==0.1.7
mccabe==0.7.0
mdurl==0.1.2
mistune==3.1.3
more-itertools==10.6.0
msgpack==1.1.0
multidict==6.2.0
mypy==1.15.0
mypy-extensions==1.0.0
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nest-asyncio==1.6.0
nh3==0.2.21
nodeenv==1.9.1
numpy==2.2.4
numpydoc==1.8.0
overrides==7.7.0
packaging==24.2
pandocfilters==1.5.1
parso==0.8.4
pdf2image==1.17.0
pillow==11.1.0
platformdirs==4.3.7
pluggy==1.5.0
pooch==1.8.2
pre_commit==4.2.0
prometheus_client==0.21.1
prompt_toolkit==3.0.50
propcache==0.3.0
proto-plus==1.26.1
protobuf==6.30.1
psutil==7.0.0
pure_eval==0.2.3
pyasn1==0.6.1
pyasn1_modules==0.4.1
pycparser==2.22
pydata-sphinx-theme==0.16.1
Pygments==2.19.1
pylint==3.3.6
pypandoc==1.15
pyparsing==3.2.1
pyproject_hooks==1.2.0
pytest==8.3.5
pytest-cov==6.0.0
pytest-rerunfailures==15.0
python-dateutil==2.9.0.post0
python-json-logger==3.3.0
pyvista==0.44.1
pywin32==310
pywin32-ctypes==0.2.3
pywinpty==2.0.15
PyYAML==6.0.2
pyzmq==26.3.0
readme_renderer==44.0
referencing==0.36.2
requests==2.32.3
requests-toolbelt==1.0.0
rfc3339-validator==0.1.4
rfc3986==2.0.0
rfc3986-validator==0.1.1
rich==13.9.4
rpds-py==0.23.1
rsa==4.9
scipy==1.15.2
scooby==0.10.0
Send2Trash==1.8.3
setuptools==77.0.3
simpervisor==1.0.0
six==1.17.0
sniffio==1.3.1
snowballstemmer==2.2.0
soupsieve==2.6
Sphinx==8.1.3
sphinx-copybutton==0.5.2
sphinx-gallery==0.19.0
sphinx_autodoc_typehints==1.20.1
sphinx_design==0.6.1
sphinxcontrib-applehelp==2.0.0
sphinxcontrib-devhelp==2.0.0
sphinxcontrib-htmlhelp==2.1.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0
stack-data==0.6.3
tabulate==0.9.0
terminado==0.18.1
tinycss2==1.4.0
tomlkit==0.13.2
tornado==6.4.2
tqdm==4.67.1
traitlets==5.14.3
trame==3.8.1
trame-client==3.6.0
trame-server==3.4.0
trame-vtk==2.8.15
trame-vuetify==2.8.1
twine==6.1.0
types-python-dateutil==2.9.0.20241206
typing_extensions==4.12.2
uri-template==1.3.0
uritemplate==4.1.1
urllib3==2.3.0
virtualenv==20.29.3
vtk==9.4.1
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
widgetsnbextension==4.0.13
wslink==2.3.2
yarl==1.18.3
zipp==3.21.0

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions