我是python的新手,我的背景是VB。我收到错误,因为“NameError:name'GetASetting'未定义”。

日志:[INFO ] Kivy v1.8.0

Purge log fired. Analysing...

Purge 60 log files

Purge finished !

[INFO ] [Logger ] Record log in C:\Users\Sudheer\.kivy\logs\kivy_14-07-18_10.txt

[INFO ] [Factory ] 157 symbols loaded

[DEBUG ] [Cache ] register with limit=None, timeout=Nones

[DEBUG ] [Cache ] register with limit=None, timeout=60s

[DEBUG ] [Cache ] register with limit=None, timeout=Nones

[INFO ] [Image ] Providers: img_tex, img_dds, img_pygame, img_gif (img_pil ignored)

[DEBUG ] [Cache ] register with limit=1000, timeout=60s

[DEBUG ] [Cache ] register with limit=1000, timeout=3600s

Traceback (most recent call last):

File "C:\Kivy180\Python33\lib\runpy.py", line 160, in _run_module_as_main

"__main__", fname, loader, pkg_name)

File "C:\Kivy180\Python33\lib\runpy.py", line 73, in _run_code

exec(code, run_globals)

File "D:\OS Files\workspace\Org\__main__.py", line 7, in

from formcontrol import FormControl

File "D:\OS Files\workspace\Org\formcontrol.py", line 8, in

from login.logincodes import LoginControl

File "D:\OS Files\workspace\Org\login\logincodes.py", line 7, in

from dbcodes.logins import LoginAccess

File "D:\OS Files\workspace\Org\dbcodes\logins.py", line 2, in

from dbcodes.settings import GetASetting, SettingList

File "D:\OS Files\workspace\Org\dbcodes\settings.py", line 31, in

class SettingList(object):

File "D:\OS Files\workspace\Org\dbcodes\settings.py", line 36, in SettingList

FirstRun_Get = GetASetting(FirstRun)

NameError: name 'GetASetting' is not defined

class和def都在同一个.py文件中。码:def Initiation():

from os import path

print(Getcwd())

folderpath=str(Getcwd())

fpath = folderpath + "/orgapp.ini"

dbpath = folderpath + "/orgapp.db"

if path.exists(fpath)==False:

#Writing Basic Values

f = open(fpath,'w')

setlist=SettingList()

f.write(setlist.FirstRun+'|True' + '\n')

f.write(setlist.IniPath+'|'+fpath + '\n')

f.write(setlist.DBPath+'|'+dbpath + '\n')

f.close()

print('File Created')

#Creating default database

CreateDB(dbpath)

return True

else:

print('File exists')

return False

def GetASetting(settingtype):

if settingtype=='': return None

path = Getcwd() + '/orgapp.ini'

f1=open(path,'r')

for k in f1:

k=k.replace('\n','')

c= (k.rsplit(sep='|', maxsplit=2))

if settingtype.lower() == c[0].lower():

f1.close()

if c[1]=='': return None

else: return c[1]

f1.close()

return None

class SettingList(object):

FirstRun = 'FirstRun'

IniPath='IniPath'

DBPath='DBPath'

FirstRun_Get = GetASetting(FirstRun)

IniPath_Get = GetASetting(IniPath)

DBPath_Get = GetASetting(DBPath)

def Getcwd():

from os import getcwd

p=''

p=getcwd()

p=p.replace('\\', '/')

return p

def CreateDB(dbpath):

import sqlite3

conn = sqlite3.Connection(dbpath, detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES)

conn.execute('''

create table login

(loginid text, password text)

''')

#default user

id='admin'

pw='1234'

conn.execute("insert into login (loginid, password) values (?,?)",(id,pw))

conn.commit()

conn.close()

我把def放在课堂上做了一些工作,但是,上面的代码应该可以工作,请你告诉我上面做了什么错误,我检查了名字,他们是正确的吗?

python找不到文件中文文件名_找不到的方法虽然存在于同一个py文件中 - python相关推荐

  1. 如果在一个工程中有两个vhd文件,就相当于有两个模块,那么对于这个工程整体的bdf文件生成,怎么把这两个模块都加到同一个bdf文件中。bdf文件中两个模块之间的连线及输入输出,是自己输进去的还是自动生

    如果在一个工程中有两个vhd文件,就相当于有两个模块,那么对于这个工程整体的bdf文件生成,怎么把这两个模块都加到同一个bdf文件中.bdf文件中两个模块之间的连线及输入输出,是自己输进去的还是自动生 ...

  2. python 中文姓名库,Python Requests库上传文件中文文件名处理方法是什么

    使用Python Requests库,提交POST请求上传文件,不支持中文文件名? 使用Python Requests库,向微信服务器上传媒体问题. 当使用英文文件名称,上传时,一切OK. 当下面代码 ...

  3. python打开中文文件名_解决python打开中文文件名乱码的问题

    解决python打开中文文件名乱码的问题 发布时间:2020-07-27 11:20:22 来源:亿速云 阅读:162 作者:清晨 小编给大家分享一下解决python打开中文文件名乱码的问题,相信大部 ...

  4. 前端传中文文件名_前端工程师需要掌握哪些知识,web前端开发规范总结

    Web前端作为开发团队中不可或缺的一部分,需要按照相关规定进行合理编写(一部分不良习惯可能给自己和他人造成不必要的麻烦).不同公司不同团队具有不同的规范和文档.下面是根据不同企业和团队的要求进行全面详 ...

  5. python zipfile extract 解压 中文文件名

    python zipfile模块官网 正常使用: 解压缩: ZipFile.extract(member,path = None,pwd = None ) 参数 解释 members zipfile ...

  6. nodejs adm-zip 解压文件 中文文件名乱码

    最近的一个项目需要上传zip文件到服务器,然后解压到当前目录,最初选用unzip包进行解压,开始使用的时候不知道这个包有监听函数,认为完全是同步的.实际是有完成解压监听函数的.使用adm-zip的时候 ...

  7. python爬取网页表格数据匹配_爬取表格类网站数据并保存为excel文件

    本文转载自以下网站:50 行代码爬取东方财富网上市公司 10 年近百万行财务报表数据 https://www.makcyun.top/web_scraping_withpython6.html 主要学 ...

  8. c++文件读取空格_程序员术与道:术—C语言对文件进行处理,文件处理的基本操作...

    各种编程语言都实现了文件的基本操作,提供了对应的接口,本篇文章先为你介绍C语言对文件进行处理和文件处理的基本操作.主要从以下几个方面进行介绍: 读取文件 写入文件 重命名文件 读取目录 读取目录下的文 ...

  9. 使用pipenv建立虚拟环境解决python打包exe文件过大的问题(附打包带图标,多个py文件打包exe)

    我们编写的程序可以发给其他小伙伴使用,但是其他小伙伴不一定安装有python.这时候就需要用到打包啦.打包可以将程序打包成exe文件.然后小伙伴在windows平台里就可以运行(无需python).直 ...

最新文章

  1. C++知识点17——使用C++标准库(顺序容器vector常用操作)
  2. 高清SDI编码器|上海视涛科技
  3. “sudo: go:找不到命令”完美解决方案
  4. gin获取get参数
  5. c mysql 延时_Mysql 优化之延迟索引和分页优化
  6. tencent intern learning
  7. 前端学习(1439):vue的helloworld
  8. oracle逗号分隔函数
  9. SpringBoot酒店管理系统 hotel.liuyanzhao.com
  10. 【韦东山嵌入式Linux】Linux命令进阶笔记
  11. Adobe软件字体导入无法显示的问题
  12. 基于HTTP协议的Java文件传输
  13. matlab读取txt文件
  14. 开发人员的 Chrome 翻译设置
  15. golang mian函数和init函数
  16. 【Java面向对象编程——喂养三种宠物】
  17. android 首页广告位,Android 使用 ViewPager循环广告位的实现
  18. open cv均值 中值 高斯 双边高斯 滤波及模糊
  19. 将一组数组尽可能均匀的分成两堆,使两个堆中的数的和尽可能相等
  20. 爱彼迎全球招募5名南极科学考察团志愿者

热门文章

  1. 【Siddhi 5】Siddhi 5 源码编译
  2. 【Flink】Flink 的状态描述符 StateDescriptor operator state key state
  3. 95-190-440-源码-window-Trigger-Trigger简介
  4. 【Git】git 如何合并两个仓库(拉取A仓库的分支到B仓库)
  5. 05-Prohibited package name: java异常原因
  6. 7种方式,教你提升 SpringBoot 项目的吞吐量
  7. SpringBoot 服务监控机制,你了解多少?
  8. 超详细讲解,带你零基础入门 kafka!
  9. 神奇的 SQL 之 HAVING → 容易被轻视的主角
  10. 设计模式是什么鬼(状态)