简体   繁体   English

在 web 浏览器中运行脚本 python

[英]Run script python in web browser

I have a script python for Reading biometric identity card with a card reader this script use this https://github.com/roeften/pypassport , i want to creat a web app with django and use this script and run it on client machine ( on web browser ), each user can read his card with a card reader on this web application. I have a script python for Reading biometric identity card with a card reader this script use this https://github.com/roeften/pypassport , i want to creat a web app with django and use this script and run it on client machine (在 web 浏览器上),每个用户都可以在此 web 应用程序上使用读卡器读取他的卡。 how can i do that?我怎样才能做到这一点? any idea can be useful looked at this part of script that I want to run on the client browser:查看我想在客户端浏览器上运行的这部分脚本,任何想法都会很有用:

from pypassport.reader import ReaderManager
from pypassport.reader import ReaderManager

from pypassport.epassport import EPassport, mrz
r = ReaderManager()
reader = r.waitForCard()
p = EPassport(reader,"YOURMRZINFO")
p.register(print)
p.setCSCADirectory("C:\\TEMP")
p.doBasicAccessControl()
p.doActiveAuthentication()

p['DG2']

if you want to run it in common browsers like "Chrome, Firefox, Opera, Edge...", that's impossible.如果你想在“Chrome、Firefox、Opera、Edge...”等常见浏览器中运行它,那是不可能的。 python must in python Virtual Machine, Browser doesn't contain that. python 必须在 python 虚拟机中,浏览器不包含。

you cant run python natively in the browser.cant在浏览器中natively运行 python。

but ofc, there are workarounds, like pypy.js (this compiles python script to javascript and then runs the js)但是 ofc 有一些解决方法,比如pypy.js (这会将 python 脚本编译为 javascript 然后运行 js)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM