Code gives the following error:
"'module' Object has no attribute 'checkNone'"
Dir setup:
+main.py
Sorcery
+Check.py
main.py
from Sorcery import Check
check = Check.checkNone(None);
Check.py
class Check:
def checkNone(content):
if content == None:
print("None!")
else:
print("Check!")
return content
First, rename the Check.py
to anything you like, eg, jacs.py
. Inside jacs.py
, change Class Check: def checkNone(content):
to Class Check(object): def checkNone(self, content):
.
Then, in main.py
, begin with
from Sorcery.jacs import Check
output = Check.checkNone(None)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.