Skip to content

Commit 9900818

Browse files
authored
convert path to string (#650)
1 parent 678e057 commit 9900818

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

ansys/mapdl/core/_commands/session/run_controls.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,23 @@ def cwd(self, dirpath="", **kwargs):
128128
After issuing the /CWD command, all new files opened with no default
129129
directory specified (via the FILE, /COPY, or RESUME commands, for
130130
example) default to the new ``dirpath`` directory.
131+
132+
Examples
133+
--------
134+
Change MAPDL's working directory to ``"C:/temp"``. This
135+
assumes that MAPDL running on Windows.
136+
137+
>>> mapdl.cwd("C:/temp")
138+
139+
MAPDL on Linux example:
140+
141+
>>> mapdl.cwd("/tmp/")
142+
131143
"""
144+
dirpath = str(dirpath)
132145
if not (dirpath.startswith('\'') and dirpath.endswith('\'')) and "'" in dirpath:
133146
raise RuntimeError('The CWD command does not accept paths that contain singular quotes "'"")
134-
command = f"/CWD,'{dirpath}'"
135-
return self.run(command, **kwargs)
147+
return self.run(f"/CWD,'{dirpath}'", **kwargs)
136148

137149
def filname(self, fname="", key="", **kwargs):
138150
"""Changes the Jobname for the analysis.

0 commit comments

Comments
 (0)