This is part of my python code which works when executing by itself.
import firebase_admin
from firebase_admin import credentials, firestore
import nltk
import docx2txt
from pdfminer.high_level import extract_text
from analysis import get_tech_result, get_management_result, get_softskill_result, feedback
nltk.download('stopwords')
nltk.download('punkt')
cred = credentials.Certificate("service_key.json")
firebase_admin.initialize_app(cred)
However, when I try to run this code via node, with this code.
const { spawn } = require('child_process');
const childPython = spawn('python', ['resume_analysis/main.py']);
childPython.stdout.on('data', (data) => {
console.log(`stdout: ${data}`);
});
childPython.stderr.on('data', (data) => {
console.error(`stderr: ${data}`);
});
childPython.on('close', (code) => {
console.log(`Child process exited with code: ${code}`);
});
It shows the following error:
stderr: Traceback (most recent call last):
File "resume_analysis/main.py", line 2, in <module>
import firebase_admin
ImportError: No module named firebase_admin
Child process exited with code: 1
Since I am new to JavaScript, I don't have much knowledge on why it is showing me errors since the python code itself works fine.