Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/ansys/mapdl/core/mapdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -3174,16 +3174,26 @@ def directory(self) -> str:
a warning.
"""
# always attempt to cache the path
try:
self._path = self.inquire("", "DIRECTORY")
except Exception:
pass
i = 0
while (not self._path and i > 5) or i == 0:
try:
self._path = self.inquire("", "DIRECTORY")
except Exception: # pragma: no cover
pass
i += 1
if not self._path: # pragma: no cover
time.sleep(0.1)

# os independent path format
if self._path: # self.inquire might return ''.
self._path = self._path.replace("\\", "/")
# new line to fix path issue, see #416
self._path = repr(self._path)[1:-1]
else: # pragma: no cover
raise IOError(
f"The directory returned by /INQUIRE is not valid ('{self._path}')."
)

return self._path

@directory.setter
Expand Down
5 changes: 1 addition & 4 deletions src/ansys/mapdl/core/mapdl_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,10 +573,7 @@ def _verify_local(self):
"""Check if Python is local to the MAPDL instance."""
# Verify if python has assess to the MAPDL directory.
if self._local:
if self._path is None:
directory = self.directory
else:
directory = self._path
directory = self.directory

if self._jobname is None:
jobname = self.jobname
Expand Down