Skip to content

Commit 99482f0

Browse files
[bugfix] Fix errors for scripts with spaces (backport #6027) (#6030)
Co-authored-by: Hailin Wang <[email protected]>
1 parent 6f59edd commit 99482f0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/abqpy/cli.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ def cae(
110110
Record the GUI commands to a file, by default None
111111
"""
112112
# Parse options
113+
script = f'"{script}"'.replace('""', '"') if " " in script else script
113114
options = self._parse_options(script=script if gui else None, noGUI=script if not gui else None,
114115
database=database, replay=replay, recover=recover, startup=startup,
115116
noenvstartup=not envstartup, noSavedOptions=not savedOptions,
@@ -136,6 +137,8 @@ def pde(self, *scripts: str, script: str | None = None, **options):
136137
options
137138
Abaqus/CAE command line arguments
138139
"""
140+
script = f'"{script}"'.replace('""', '"') if script is not None and " " in script else script
141+
scripts = tuple(f'"{s}"'.replace('""', '"') if " " in s else s for s in scripts)
139142
cae_opts = self._parse_options(**options)
140143
args = (*scripts,) + ((f"script={script}",) if script else ()) + ("-pde",) + ((cae_opts,) if cae_opts else ())
141144
return self.abaqus("pde", *args)
@@ -164,6 +167,7 @@ def python(
164167
options = self._parse_options(sim=sim, log=log)
165168

166169
# Execute command
170+
script = f'"{script}"'.replace('""', '"') if " " in script else script
167171
return self.abaqus("python", script, options, *args)
168172

169173
@typechecked

0 commit comments

Comments
 (0)