Why does my tkinter app will show a node.js window?

会有一股神秘感。 提交于 2020-04-16 05:13:11

问题


I use pyinstaller to pack a .py file.

Then when I use something about web crawler (I use requests module).

This window will show and disappear fastly.

I want to say that it is maybe incredible.It wouldn't pop this window when I run this .py file,but after using pyinstaller to pack it,it will pop this window.

(In another computer,it doesn't install node.js.And it doesn't pop this window)

Here is the module I use:

from pynput import keyboard
from PIL import Image, ImageTk
import ctypes
from io import BytesIO
import threading
from win10toast import ToastNotifier
import base64
from win32com.shell import shell
import requests
import execjs
import sys
import pythoncom
import getpass
import tkinter
from random import randint
from tkinter import ttk
from tkinter import messagebox
import os
import json
import traceback
from webbrowser import open_new_tab
from tkinter import scrolledtext
import win32con, win32clipboard, win32gui
from PIL.ImageGrab import grabclipboard, grab
from aip import AipOcr
import time

And the window is this:

What should I do except uninstall node.js? How to avoid this node.js window shows? Thanks in advance.


回答1:


Thanks bro,acw1668's suggestion enlighten me a lot.

I want to say,execjs module will run js code. And if your computer install node.js and you set PATH for node.js,Then your default js environment is node.js(If you don't install node.js,then your default js environment is Jscript in windows system).

So if you doesn't want to use node.js,you should set the default js environment in python.

# change the js environment.
os.environ["EXECJS_RUNTIME"] = "JScript"

# all of environment which execjs support
  PyV8           = "PyV8"
  Node           = "Node"
  JavaScriptCore = "JavaScriptCore"
  SpiderMonkey   = "SpiderMonkey"
  JScript        = "JScript"
  PhantomJS      = "PhantomJS"
  SlimerJS       = "SlimerJS"
  Nashorn        = "Nashorn"


来源:https://stackoverflow.com/questions/60351780/why-does-my-tkinter-app-will-show-a-node-js-window

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!