Python 使用kivy上传文件

Python 使用kivy上传文件,python,kivy,filechooser,Python,Kivy,Filechooser,我正在尝试创建一个注册屏幕,允许用户上传简历和其他文件。我尝试使用filechooser执行此操作,但它不起作用。你对如何做有什么建议吗 class SignupWindow(Screen): first_name: ObjectProperty(None) middle_name: ObjectProperty(None) last_name: ObjectProperty(None) email2 = ObjectProperty(None) pas

我正在尝试创建一个注册屏幕,允许用户上传简历和其他文件。我尝试使用filechooser执行此操作,但它不起作用。你对如何做有什么建议吗

class SignupWindow(Screen):

    first_name: ObjectProperty(None)
    middle_name: ObjectProperty(None)
    last_name: ObjectProperty(None)
    email2 = ObjectProperty(None)
    password2: ObjectProperty(None)
    profession: ObjectProperty(None)

       
    def signupbtn(self):
        user = auth.create_user_with_email_and_password(self.email2.text, self.password2.text)
        auth.send_email_verification(user['idToken'])
        user_info = {
            u'Last name' : self.last_name.text,
            u'Middle name' : self.middle_name.text,
            u'First name': self.first_name.text,
            u'Email' : self.email2.text,
            u'Profession' : self.profession.text,
            u'birth' : self.birth.text
        }
        db.collection(u'users').document(self.email2.text).set(user_info)
        sm.current = 'login'

    def Resume_selection(self):
        image_path = self.fc.selection[0]
        image_name = file_path.split('/')[-1]
:
名字:名字
中间名称:中间名称
姓氏:姓氏
email2:email2
密码2:密码2
职业:职业
出生:出生
电话:电话
简历:简历
滚动视图:
网格布局:
方向:“垂直”
尺寸提示:无
高度:自身最小高度
行\默认\高度:30
科尔斯:2
间距:15,15
填充:100100
标签:
文本:“名字:”
文本输入:
id:名字
提示文字:“名字”
多行:False
标签:
文本:“中间名:”
文本输入:
id:中间名
提示文字:“中间名”
多行:False
标签:
文本:“姓氏:”
文本输入:
id:姓
提示文字:“姓氏”
多行:False
标签:
正文:“出生日期:”
文本输入:
id:出生
提示文字:“mm/dd/yyyy”
多行:False
标签:
文本:“电子邮件:”
文本输入:
id:email2
提示文字:“email@domain.com"
多行:False
标签:
文本:“密码:”
文本输入:
id:密码2
提示文字:“选择密码”
多行:False
密码:True
标签:
文本:“密码:”
文本输入:
提示文字:“再次键入密码”
多行:False
密码:True
标签:
文字:“电话号码:”
文本输入:
id:电话
提示文字:“xxx xxx xxxx”
多行:False
标签:
正文:“职业:
文本输入:
id:职业
提示文字:“职业”
多行:False
标签:
正文:“简历:”
#文本输入:
id:简历
提示文字:“请附上您的简历”
多行:False
#FileChooseConView:
id:简历
文本:“上传简历”
FileChooseConView:
id:filechooser
标题:“上传简历”
大小:self.size
pos:self.pos
在\u选择上:根目录。恢复\u选择(filechooser.selection)
按钮:
案文:“提交”
新闻界:
root.signupbtn()
root.manager.transition.direction=“右”
按钮:
文本:“登录”
发布时:
root.manager.current='login'
root.manager.transition.direction=“向上”
错误如下:

[错误]无法访问 回溯(最近一次呼叫最后一次): 文件“C:\Users\remio\PycharmProjects\pythonProject1\venv\lib\site packages\kivy\uix\filechooser.py”第178行隐藏在 返回GetFileAttributesExW(fn)[0]&文件属性隐藏 pywintypes.error:(32,'GetFileAttributesEx','该进程无法访问该文件,因为它正被另一个进程使用。')) [错误]无法访问 回溯(最近一次呼叫最后一次): 文件“C:\Users\remio\PycharmProjects\pythonProject1\venv\lib\site packages\kivy\uix\filechooser.py”第178行隐藏在 返回GetFileAttributesExW(fn)[0]&文件属性隐藏 pywintypes.error:(32,'GetFileAttributesEx','该进程无法访问该文件,因为它正被另一个进程使用。')) [错误]无法访问 回溯(最近一次呼叫最后一次): 文件“C:\Users\remio\PycharmProjects\pythonProject1\venv\lib\site packages\kivy\uix\filechooser.py”第178行隐藏在 返回GetFileAttributesExW(fn)[0]&文件属性隐藏 pywintypes.error:(32,'GetFileAttributesEx','该进程无法访问该文件,因为它正被另一个进程使用。'))


谢谢

什么时候抛出这些错误?在第一次渲染时,单击“选择”按钮或选择文件后?显示更多信息codes@emi,运行应用程序时会立即抛出错误,并且应用程序仍然正常运行。@Nelsonsole,我肯定会在返回主页时添加更多代码。@Nelsonsole,请检查更新的代码
<SignupWindow>:
    first_name: first_name
    middle_name: middle_name
    last_name: last_name
    email2: email2
    password2: password2
    profession: profession
    birth: birth
    phone: phone
    resume: resume


    ScrollView:

        GridLayout:
            orientation: "vertical"
            size_hint_y: None
            height: self.minimum_height
            row_default_height: 30
            cols:2
            spacing: 15, 15
            padding: 100, 100

            Label:
                text : "First Name: "

            TextInput:
                id : first_name
                hint_text: "First name"
                multiline : False

            Label:
                text : "Middle Name: "

            TextInput:
                id : middle_name
                hint_text: "Middle name"
                multiline : False

            Label:
                text : "Last Name: "

            TextInput:
                id : last_name
                hint_text: "Last name"
                multiline : False

            Label:
                text : "Date of Birth: "

            TextInput:
                id : birth
                hint_text: "mm/dd/yyyy"
                multiline : False

            Label:
                text : "Email: "

            TextInput:
                id : email2
                hint_text: "email@domain.com"
                multiline : False

            Label:
                text : "Password: "

            TextInput:
                id : password2
                hint_text: "Choose a password"
                multiline : False
                password: True


            Label:
                text : "Password: "

            TextInput:
                hint_text: "Type your password again"
                multiline : False
                password: True


            Label:
                text : "Phone number: "

            TextInput:
                id : phone
                hint_text: "xxx-xxx-xxxx "
                multiline : False



            Label:
                text : "Profession: "

            TextInput:
                id : profession
                hint_text: "Profession"
                multiline : False

            Label:
                text : "Resume: "

            #TextInput:
                id : resume
                hint_text: "Please attach your Resume"
                multiline : False

            #FileChooserIconView:
                id: resume
                text: "Upload Resume"

            FileChooserIconView:
                id:filechooser
                title: 'Upload a resume'
                size: self.size
                pos : self.pos
                
                on_selection : root.Resume_selection(filechooser.selection)

            Button:
                text : "Submit"
                on_press :
                    root.signupbtn()
                    root.manager.transition.direction = "right"

            Button:
                text : "Login"
                on_release:
                    root.manager.current = 'login'
                    root.manager.transition.direction = "up"