Skip to content
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

Fixed 'TypeError: PythonShell is not a constructor' #35

Open
wants to merge 1 commit into
base: master
from
Open
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Fixed 'TypeError: PythonShell is not a constructor' as suggested by @…

  • Loading branch information...
@wunderbear
@wunderbear committed Jan 3, 2019
commit 3f23f12d72d751567df67aebe33e1263be26bf81
@@ -23,7 +23,7 @@ def download_phone_book(self, directory = "data"):
if (len(result) == 0):
raise Exception("Please check if your user has access to \"View and edit FRITZ!Box settings\".")
sys.exit(1)
for phonebook_id in result["NewPhonebookList"]:
for phonebook_id in result["NewPhonebookList"].replace(",", ""):
result_phonebook = self.fc.call_action("X_AVM-DE_OnTel", "GetPhonebook", NewPhonebookID=phonebook_id)
filename = os.path.join(directory, "pbook_%s.xml" % phonebook_id)
self.forward_file(result_phonebook["NewPhonebookURL"], filename)
@@ -7,7 +7,7 @@ const phoneFormatter = require("phone-formatter");
const xml2js = require("xml2js");
const moment = require('moment');
const exec = require('child_process').exec;
const PythonShell = require('python-shell');
const {PythonShell} = require('python-shell');
const path = require("path");

const CALL_TYPE = Object.freeze({
@@ -196,7 +196,7 @@ module.exports = NodeHelper.create({
console.log('Starting access to FRITZ!Box...');
}

var args = ['-i', self.config.fritzIP, '-p', self.config.password];
let args = ['-i', self.config.fritzIP, '-p', self.config.password];
if (self.config.username !== "")
{
args.push('-u');
@@ -207,13 +207,14 @@ module.exports = NodeHelper.create({
args.push(additionalOption);
}

var options = {
let options = {
pythonPath: 'python',
mode: 'json',
scriptPath: path.resolve(__dirname),
args: args
};

var pyshell = new PythonShell('fritz_access.py', options);
let pyshell = new PythonShell('fritz_access.py', options);

pyshell.on('message', function (message) {
if (message.filename.indexOf("calls") !== -1)
@@ -25,5 +25,5 @@
"phone-formatter": "latest",
"python-shell": "latest",
"xml2js": "latest"
}
}
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.