-
Notifications
You must be signed in to change notification settings - Fork 222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
not getting print from python script #273
Comments
hi check out my whole project at |
thanks |
Not sure, I tried running some code adapted from your example and it worked: import sys
import PyPDF2
from gtts import gTTS
import random
random.seed(5)
# creating a pdf file object
pdfFileObj = open(sys.argv[1], 'rb')
rap = sys.argv[1]
# creating a pdf reader object
pdfReader = PyPDF2.PdfFileReader(pdfFileObj)
# printing number of pages in pdf file
k =0
txt=""
pgno = pdfReader.numPages
while(k< pgno):
# creating a page object
pageObj = pdfReader.getPage(k)
# extracting text from page
txt+=pageObj.extractText()
k+=1
# closing the pdf file object
pdfFileObj.close()
tts = gTTS(txt)
ran = random.random()*0
nam =rap+str(ran)+'0.mp3'
nam =rap+'0.mp3'
tts.save(nam)
print(nam) const {PythonShell} =require('python-shell');
# be sure to replace the below!
var argz = 'put your path here';
let options = {
mode: 'text',
pythonOptions: ['-u'], // get print results in real-time
// scriptPath: 'path/to/my/scripts', //If you are having python_test.py script in same folder, then it's optional.
args: [argz] //An argument which can be accessed in the script using sys.argv[1]
};
console.log("53")
PythonShell.run('new.py', options, function (err, result){
console.log("started py")
if (err) throw err;
// result is an array consisting of messages collected
//during execution of script.
console.log('result: ', result.toString());
}); As a rule of thumb when debugging, try to simplify your code until it's working, and then build back up to figure out where it went wrong. |
|
The Question:
trying to pass back the file path that is create dbut not recieving any
any ideas
Any relevant python/javascript code:
my server
dependecy
The text was updated successfully, but these errors were encountered: