dante commited on
Commit
9e4e50b
·
verified ·
1 Parent(s): 63f124a

Upload 19 files

Browse files
Files changed (1) hide show
  1. server.js +6 -1
server.js CHANGED
@@ -336,7 +336,12 @@ app.post('/api/download/pdf', async (req, res) => {
336
  const pdfPath = path.join(downloadsDir, pdfName); // Use full path
337
 
338
  // 2. Call Python Script in Unbuffered mode
339
- const pythonProcess = spawn('python', ['-u', 'converter.py']);
 
 
 
 
 
340
 
341
  // Send data to Python via STDIN
342
  pythonProcess.stdin.write(JSON.stringify({
 
336
  const pdfPath = path.join(downloadsDir, pdfName); // Use full path
337
 
338
  // 2. Call Python Script in Unbuffered mode
339
+ // HACKER FIX: En Docker/Linux a menudo es 'python3', en Windows 'python'
340
+ const pythonCmd = process.env.PYTHON_CMD || (process.platform === 'win32' ? 'python' : 'python3');
341
+ console.log(`[SERVIDOR] Usando comando Python: ${pythonCmd}`);
342
+
343
+ const scriptPath = path.join(__dirname, 'converter.py');
344
+ const pythonProcess = spawn(pythonCmd, ['-u', scriptPath]);
345
 
346
  // Send data to Python via STDIN
347
  pythonProcess.stdin.write(JSON.stringify({