Page 1 of 1

phcharm 中 image_size, base_dir, output_file 如何赋值给 spiffsgen.main()

Posted: Mon Nov 08, 2021 5:01 am
by dustralia
在CMD中调用spiffsgen可以正常工作生成bin,在pycharm调用不了spiffsgen

spiffsgen.main(['0x170000', 'data', 'data.bin']) 这样执行后,
报错信息是:
spiffsgen.main(['0x170000', 'data', 'data.bin'])
TypeError: main() takes 0 positional arguments but 1 was given

spiffsgen.main() 这样执行后,
报错信息是 error:
the following arguments are required: image_size, base_dir, output_file

Re: phcharm 中 image_size, base_dir, output_file 如何赋值给 spiffsgen.main()

Posted: Mon Nov 08, 2021 12:43 pm
by ESP_ICY
这边希望你把问题描述的更清楚一点。pycharm 只是一个应用平台,里面也有cmd终端,所以你这边的问题具体是什么,你是在pycharm里写了一个python脚本吗还是在pycharm的终端中输入命令

Re: phcharm 中 image_size, base_dir, output_file 如何赋值给 spiffsgen.main()

Posted: Tue Nov 09, 2021 1:40 am
by dustralia
附上代码,代码最下面的几行是尝试的调用 spiffsgen.main(),不过都出问题了,想请教如何正确调用 spiffsgen.main()

from tkinter import *
import esptool
import spiffsgen

window = Tk()

sizeButtonStyleX = 550
sizeButtonStyleY = 100

img0 = PhotoImage(file="system\\pic\\0.png")
img1 = PhotoImage(file="system\\pic\\1.png")
img2 = PhotoImage(file="system\\pic\\2.png")
img3 = PhotoImage(file="system\\pic\\3.png")
img4 = PhotoImage(file="system\\pic\\4.png")
img5 = PhotoImage(file="system\\pic\\5.png")
img6 = PhotoImage(file="system\\pic\\6.png")
img7 = PhotoImage(file="system\\pic\\7.png")
img8 = PhotoImage(file="system\\pic\\8.png")
imgicon = PhotoImage(file="system\\pic\\icon.png")

window.title("DOWNLOAD TOOL")
window.geometry("1120x480+500+200") # 窗口大小()*(),窗口右上角距离屏幕右上角偏移+()+()
window.iconphoto(False, imgicon)

frame0 = Frame(window, relief=RAISED, borderwidth=1) # RELIEF=["flat", "raised", "sunken", "solid", "ridge", "groove"]
frame0 .place(x=0, y=0, width=1120, height=30)

frame1 = Frame(window, relief=RAISED, borderwidth=1)
frame1 .place(x=0, y=30, width=1120, height=410)

frame2 = Frame(window, relief=RAISED, borderwidth=1)
frame2 .place(x=0, y=445, width=1120, height=30)

label2 = Label(frame2, text=" 下载方法: ", font=('微软雅黑', 10))
label2.pack()

# spiffsgen.main(['--image_size', '0x170000', '--base_dir', 'data', '--output_file', 'data.bin'])

# spiffsgen.main(--image_size, '0x170000', --base_dir, 'data', --output_file, 'data.bin')

# spiffsgen.main('image_size', '0x170000', 'base_dir', 'data', 'output_file', 'data.bin')

# spiffsgen.main(image_size, '0x170000', base_dir, 'data', output_file, 'data.bin')

# spiffsgen.main(image_size='0x17000', base_dir='data', output_file='data.bin')

# spiffsgen.main('0x170000', 'data', 'data.bin')

# spiffsgen.main(['image_size', '0x170000', 'base_dir', 'data', 'output_file', 'data.bin'])

# spiffsgen.main()

Re: phcharm 中 image_size, base_dir, output_file 如何赋值给 spiffsgen.main()

Posted: Tue Nov 09, 2021 6:47 am
by dustralia
ESP_ICY wrote:
Mon Nov 08, 2021 12:43 pm
这边希望你把问题描述的更清楚一点。pycharm 只是一个应用平台,里面也有cmd终端,所以你这边的问题具体是什么,你是在pycharm里写了一个python脚本吗还是在pycharm的终端中输入命令
附上代码,代码最下面的几行是尝试的调用 spiffsgen.main(),不过都出问题了,想请教如何正确调用 spiffsgen.main()

from tkinter import *
import esptool
import spiffsgen

window = Tk()

sizeButtonStyleX = 550
sizeButtonStyleY = 100

img0 = PhotoImage(file="system\\pic\\0.png")
img1 = PhotoImage(file="system\\pic\\1.png")
img2 = PhotoImage(file="system\\pic\\2.png")
img3 = PhotoImage(file="system\\pic\\3.png")
img4 = PhotoImage(file="system\\pic\\4.png")
img5 = PhotoImage(file="system\\pic\\5.png")
img6 = PhotoImage(file="system\\pic\\6.png")
img7 = PhotoImage(file="system\\pic\\7.png")
img8 = PhotoImage(file="system\\pic\\8.png")
imgicon = PhotoImage(file="system\\pic\\icon.png")

window.title("DOWNLOAD TOOL")
window.geometry("1120x480+500+200") # 窗口大小()*(),窗口右上角距离屏幕右上角偏移+()+()
window.iconphoto(False, imgicon)

frame0 = Frame(window, relief=RAISED, borderwidth=1) # RELIEF=["flat", "raised", "sunken", "solid", "ridge", "groove"]
frame0 .place(x=0, y=0, width=1120, height=30)

frame1 = Frame(window, relief=RAISED, borderwidth=1)
frame1 .place(x=0, y=30, width=1120, height=410)

frame2 = Frame(window, relief=RAISED, borderwidth=1)
frame2 .place(x=0, y=445, width=1120, height=30)

label2 = Label(frame2, text=" 下载方法: ", font=('微软雅黑', 10))
label2.pack()

# spiffsgen.main(['--image_size', '0x170000', '--base_dir', 'data', '--output_file', 'data.bin'])

# spiffsgen.main(--image_size, '0x170000', --base_dir, 'data', --output_file, 'data.bin')

# spiffsgen.main('image_size', '0x170000', 'base_dir', 'data', 'output_file', 'data.bin')

# spiffsgen.main(image_size, '0x170000', base_dir, 'data', output_file, 'data.bin')

# spiffsgen.main(image_size='0x17000', base_dir='data', output_file='data.bin')

# spiffsgen.main('0x170000', 'data', 'data.bin')

# spiffsgen.main(['image_size', '0x170000', 'base_dir', 'data', 'output_file', 'data.bin'])

# spiffsgen.main()

Re: phcharm 中 image_size, base_dir, output_file 如何赋值给 spiffsgen.main()

Posted: Thu Nov 18, 2021 9:46 am
by ESP_Gargamel
你这是要在 python 中调用另一个 python,直接 百度 一下即可。