I m having serious trouble sorting out scoping error in my project. My project looks something like this:
这份主要文件载有这一进程,并用警棍打造了全球调查。
interfaceAndProcess.pyw
import lib1
...
#do something with tkinter
filePath = askopenfilename(filetypes=(("All files", "*.*")))
...
lib1.checkSomeDocument(filePath)
然后,我有“其他平衡”职能。
moalibs.py
def parseSomething(lookForStringX)
position = line.index(lookForStringX, 0)
return(position)
def bla():
...
def blabla():
...
这里是使用分子方法的许多平衡之一。 y
lib1.py
from moalibs import *
def checkSomeDocument(filePath)
global line
fileContent = open(filePath, r )
for line in fileContent:
tmpVar = parseSomething(lookForStringX)
...
tmpVar = bla()
...
tmpVar = blabla()
...
tmpVar = bla()
# In any of my many libs the methods from moalib are called
# serveral times in different orders, that s why this part
# is pretty "hard coded"
我的问题是,实施接口。 pyw向以下线投掷了名词:“名称线没有界定”。
为什么可以打上<条码>。 见《瓦尔<条码>。
当我把<代码>parseSomething列入moalibs.py
。 正在做的是罚款。
I m sorry for this question to be pretty specific but I m searching and trying for for more than two hours now.
Been playing with global line
inside the methods, been defining line
inside interfaceAndProcess.pyw, nothing...
任何建议?
Edit: Ok, I understood that what I have tried can t work as I expected. How would I achieve this without passing the variable as an argument?