Python &引用&引用;“完整设置”;不是模块的已知成员”;似乎是什么都没有的错误造成的
我正在尝试使用Python和Bash编写安装后脚本,但在定义函数时遇到了问题。以下是该程序的主文件:Python &引用&引用;“完整设置”;不是模块的已知成员”;似乎是什么都没有的错误造成的,python,linux,bash,archlinux,Python,Linux,Bash,Archlinux,我正在尝试使用Python和Bash编写安装后脚本,但在定义函数时遇到了问题。以下是该程序的主文件: #!/usr/bin/env python3 import variables # Main program loop while True: userResponse = str.lower(input('''What would you like to do? f: Starts the full post-install setup u: Starts con
#!/usr/bin/env python3
import variables
# Main program loop
while True:
userResponse = str.lower(input('''What would you like to do?
f: Starts the full post-install setup
u: Starts configuring users
p: Starts the packages setup
s: Starts the systemctl setup
c: Starts the configs setup
q: Terminates the program\n'''))
if userResponse == 'f':
print('Starting full post-install setup...')
variables.fullSetup()
elif userResponse == 'u':
variables.configureUsers()
elif userResponse == 'p':
variables.installEssentialPackages()
elif userResponse == 's':
variables.configureSystemctl()
elif userResponse == 'c':
variables.configureSystem()
elif userResponse == 'q':
print('Terminating program...')
quit()
else:
print('Input not recognized.')
下面是变量文件:
import subprocess
def configureUsers():
print('Attempting to configure system users...')
subprocess.run(
'./post_install_scripts/01_users.sh',
shell = True)
def installEssentialPackages():
print('Attempting to install essential packages...')
subprocess.run(
'./post_install_scripts/02_pkgs.sh',
shell = True)
def configureSystemctl():
print('Attempting to configure systemctl...')
subprocess.run(
'./post_install_scripts/03_systemctl.sh',
shell = True)
def configureSystem():
print('Attempting to configure system...')
subprocess.run(
'./post_install_scripts/04_configs.sh',
shell = True)
def fullSetup():
print('Attempting to run a full setup...')
configureUsers()
installEssentialPackages()
configureSystemctl()
configureSystem()
在第19行,我得到了以下错误:
"fullSetup" is not a known member of a module
我不明白我现在做错了什么。我觉得一切都很好。如果你想在Github上看到整个回购协议,你可以
希望这里有人能帮我
额外信息
- 我正在使用ArchLinux
- 我有最新的Python版本
- 我用Neovim做我的编辑
您是如何尝试运行此功能的?我刚刚克隆了你的回购协议并运行:
python3 setup.py
我明白了:
What would you like to do?
f: Starts the full post-install setup
u: Starts configuring users
p: Starts the packages setup
s: Starts the systemctl setup
c: Starts the configs setup
q: Terminates the program
这是在使用Python3.7
我应该进一步澄清,您是在运行代码时看到此错误,还是仅仅从mypy之类的类型检查器中看到此错误?“fullSetup”不是看起来不像Python错误的模块的已知成员。那个错误到底是从哪里来的?@JohnGordon,它是从Neovim来的。我正在使用Neovim的Pyright语言服务器。我的编辑器中出现了错误。我在Neovim中使用Pyright语言服务器。我怀疑问题在于语言服务器执行的静态分析。如果您能够成功地运行代码,那么这种静态分析就是一种转移注意力的方法。Python的静态分析常常充满这样的错误否定。我想有一种方法可以让Pyright找到答案,也许是一个\uuuu init\uuuuu.py
文件或类似的东西,但我对Pyright和它在引擎盖下使用的任何类型检查器都不太熟悉。错误似乎已经消失了。我什么也没做,只是消失了。我想那很酷?你喜欢看!也许你的编辑只是对世界有一种陈旧的看法。