Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

224
Views
Cómo ejecutar este archivo python sin usar el símbolo del sistema (puramente código)

Estoy tratando de ejecutar un archivo python llamado testingFile.py dentro de una extensión de VS Code como se muestra a continuación:

 // The module 'vscode' contains the VS Code extensibility API // Import the module and reference it with the alias vscode in your code below const { ChildProcess } = require('child_process'); const vscode = require('vscode'); const { exec } = require('node:child_process'); // this method is called when your extension is activated // your extension is activated the very first time the command is executed /** * @param {vscode.ExtensionContext} context */ function activate(context) { let disposable = vscode.commands.registerCommand('fileDialog.openFile', function () { const options = { canSelectMany: false, openLabel: 'Open' }; vscode.window.showOpenDialog(options).then(fileUri => { if (fileUri && fileUri[0]) { console.log('Selected file: ' + fileUri[0].fsPath); } }); }); context.subscriptions.push(disposable); } // this method is called when your extension is deactivated function deactivate() {} module.exports = { activate, deactivate }

todo lo que hace esta extensión es abrir un cuadro de diálogo de archivo. cuando me gustaría hacer es lo siguiente: una vez que obtenga la ruta del archivo del usuario, quiero activar la ejecución de testingFile.py. tenga en cuenta que testingFile.py se encuentra en la misma ubicación que extension.ts (el código que se ve arriba). Inicialmente estaba tratando de usar spawn o exec . Me cuesta mucho hacer que funcionen.

Tal vez también podría ejecutarse usando los comandos integrados de vs code, como vscode.commands.executeCommand('python.execInInterminal...)

pero no puedo entender cómo funciona.

¡Cualquier consejo sería muy apreciado!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!