0
votes

I am developing an extension in/for VSCode. The extension uses a python script which creates generates a file. The python script has some imports viz.

import os

The extension runs fine and generates the file in the Extension Development View. However when it is installed (from .vsix) and ran, it does not work properly. Particularly, the functions which come with the imported modules does not work.

I have tried to run thee python script through python-shell and also child_process with the same results.

const execLocation = context.asAbsolutePath("path to script");
        const {PythonShell} = require('python-shell');

PythonShell.run(execLocation, null, function (err: any, res: any[]) {
        if (err) { throw err; }
        console.log(res[0]); 
        });

I do not get any error messages. Need some help regarding this.

1

1 Answers

0
votes

I figured out. Move the script to the root of the extension directory instead of any subdirectories like src or out.