I have a bat file called create_bundle.bat that has only 1 line in it:
browserify ./index.js > ./bundle.js
and if I activate this file, it creates a bundle file
I would like to execute this bat file every time I run my python 3.7 code. I have this code:
import subprocess
import pathlib
import os
def create_bundle():
directory_path = pathlib.Path(__file__).parent.absolute()
file_path = os.path.join(directory_path, "create_bundle.bat")
with open(os.path.join(directory_path, "temp_log.txt"), "w") as f:
subprocess.call([file_path], stdout=f, stderr=f)
I am getting this error:
(PythonEnv) C:\Program Files\JetBrains\PyCharm 2019.3.1\jbr\bin>browserify ./index.js 1>./bundle.js
Error: Cannot find module 'C:\Program Files\JetBrains\PyCharm 2019.3.1\jbr\bin\index.js' from 'C:\Program Files\JetBrains\PyCharm 2019.3.1\jbr\bin'
at C:\Users\localuser\AppData\Roaming\npm\node_modules\browserify\node_modules\browser-resolve\node_modules\resolve\lib\async.js:55:21
at load (C:\Users\localuser\AppData\Roaming\npm\node_modules\browserify\node_modules\browser-resolve\node_modules\resolve\lib\async.js:69:43)
at onex (C:\Users\localuser\AppData\Roaming\npm\node_modules\browserify\node_modules\browser-resolve\node_modules\resolve\lib\async.js:92:31)
at C:\Users\localuser\AppData\Roaming\npm\node_modules\browserify\node_modules\browser-resolve\node_modules\resolve\lib\async.js:22:47
at FSReqCallback.oncomplete (fs.js:158:21)
What am I doing wrong?