Skip to content
This repository has been archived by the owner on Mar 6, 2022. It is now read-only.

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fritz_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 5 additions & 4 deletions node_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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');
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@
"phone-formatter": "latest",
"python-shell": "latest",
"xml2js": "latest"
}
}
}