-
Notifications
You must be signed in to change notification settings - Fork 84
windows: UnicodeDecodeError: 'gbk' codec can't decode #4
Copy link
Copy link
Closed
Description
Env
- windwos 10 amd64
- py 3.9.0
- pyflowchart 0.1.0
Err
code
# This is statement is required by the build system to query build info
if __name__ == '__build__':
raise Exception
# cube.py
# Converted to Python by Jason Petrone 6/00
import sys
try:
from OpenGL.GLUT import *
from OpenGL.GL import *
from OpenGL.GLU import *
except:
print("ERROR: PyOpenGL not installed properly")
def init():
glClearColor(0.0, 0.0, 0.0, 0.0)
glShadeModel(GL_FLAT)
def display():
glClear(GL_COLOR_BUFFER_BIT)
glColor3f(1.0, 1.0, 1.0)
glLoadIdentity() # clear the matrix
# viewing transformation
gluLookAt(0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0)
glScalef(1.0, 2.0, 1.0) # modeling transformation
glutWireCube(1.0)
glFlush()
def reshape(w, h):
glViewport(0, 0, w, h)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
glFrustum(-1.0, 1.0, -1.0, 1.0, 1.5, 20.0)
glMatrixMode(GL_MODELVIEW)
glutInit(sys.argv)
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB)
glutInitWindowSize(500, 500)
glutInitWindowPosition(100, 100)
glutCreateWindow('cube')
init()
glutDisplayFunc(display)
glutReshapeFunc(reshape)
glutMainLoop()Exceptioin
$ python -m pyflowchart cube.py
Traceback (most recent call last):
File "D:\Program Files\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "D:\Program Files\Python\Python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "D:\Program Files\Python\Python39\lib\site-packages\pyflowchart\__main__.py", line 33, in <module>
main(args.code_file, args.field, args.inner)
File "D:\Program Files\Python\Python39\lib\site-packages\pyflowchart\__main__.py", line 16, in main
code = code_file.read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0xaa in position 355: illegal multibyte sequence另一个代码证明了不是code问题,也爆出了同样的错误,因此错误是由于该模块本身的问题...但是我目前的知识还不足以维护这个模块...
code2
import math
# 计算磁环的横截面积F cm^2
def calMagnetRingCrossArea(D, d, h):
return (0.5 * h * (D + d))
# 计算磁环平均长度l cm
def calMagnetRingLength(D, d):
return (0.5 * (D + d) * math.pi)
# 计算磁环绕线电感的电感L mH
def calInductance(u, N, F, l):
return 0
# 计算线圈匝数N
def calRingNumber(u, L, F, l):
return math.sqrt((L * l * math.pow(10,5))/(0.4 * math.pi * u * F))
u = 75
D = 3.3
d = 1.99
h = 1.07
L = 50.0
F = calMagnetRingCrossArea(D,d,h)
l = calMagnetRingLength(D,d)
N = calRingNumber(u,L,F,l)
print(N)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels