Closed jstitlow closed 4 years ago
Maria had the same problem on her mac. She's using anaconda. The questions file needed to have the .py
file extension. Does that fix it for you too?
Yes, thanks, but then it doesn't like the questions.py file:
(py38) Joshs-MacBook-Pro-6:josh joshtitlow$ python3 ../new/new_questionnaire.py questions.py answers/ figures/CB_figures_20200201/*.jpg
Traceback (most recent call last):
File "../new/new_questionnaire.py", line 268, in <module>
main(sys.argv)
File "../new/new_questionnaire.py", line 260, in main
questions = read_questions(args.questions_fpath)
File "../new/new_questionnaire.py", line 50, in read_questions
spec.loader.exec_module(module)
File "<frozen importlib._bootstrap_external>", line 779, in exec_module
File "<frozen importlib._bootstrap_external>", line 916, in get_code
File "<frozen importlib._bootstrap_external>", line 846, in source_to_code
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "questions.py", line 1
Is gene expressed in NBs?
^
SyntaxError: invalid syntax
How should the questions.py file be formatted? Do you have an example? Mine is like this:
Is gene expressed in NBs?
Obvious transcriptional regulation?
Obvious post-transcriptional regulation?
Is data acceptable?
Sorry, instructions are in the header. Here is an example for those who are python impaired:
QUESTIONS = [('Is gene expressed in NBs?', ('no', 'yes')), ('Obvious transcriptional regulation?', ('no', 'yes')), ('Comments', '')]
By the way, note that the questions file is python code so you can use whatever to generate a variable named QUESTIONS
. The change is to accommodate the new requirements from Ilan's group, i.e., where different questions may have different sets of choices and the answer to some questions can be text.
default_answers = ('unsure', 'yes', 'no')
QUESTIONS = [
('Level of expression',
('none', 'low', 'high')),
('Is gene expressed in NBs?',
default_answers),
('Is data acceptable',
default_answers),
('What\'s the problem on this image?',
'this can be an empty string or the initial answer text'),
]
Because the questions code can be python code, it is possible to end up with a questions file where their order changes between runs. The answers file now also includes the actual question text so that whoever analysis the results can double check. It also helps in preventing a case where different people are scoring with accidentally different or out of date questions files.
I replaced the use of importlib with exec which should be less sensitive. At least the file extension should no longer matter.
I am unable to run the GUI.
Before that, there is an error in calling importlib:
which I solve by adding:
from importlib import util
Any idea what causes the 'NoneType' AttributeError? Thanks! j