Estoy tratando de ejecutar un script de shell en Spyder (Python 3.8). He intentado lo siguiente y todo esto me está dando el mismo error: sintaxis no válida
bash./filename.sh
bash filename.sh
sh filename.sh
sh./filename.sh
shell./filename.sh
shell filename.sh
importar subproceso subproceso.ejecutar(.\nombrearchivo.sh)
source filename.sh
nueve.
import subprocess
subprocess.run(filename.sh)
El último da el error:
el nombre 'nombre de archivo' no existe.
Nota: he vuelto a comprobar mi pwd.
Solución del problema
Agregar citas
subprocess.run("filename.sh")
Además, me gustaría señalar que, a menos que esté utilizando algún paquete para agregar la sintaxis bash
, sh
etc., obtendrá el error de sintaxis ya que Python no sabe qué significan esas palabras clave.
No hay comentarios.:
Publicar un comentario