You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@steve.apache.org by "Neal McBurnett (JIRA)" <ji...@apache.org> on 2019/04/13 17:56:00 UTC

[jira] [Created] (STEVE-54) circular dependencies in setup.py: cannot import name election

Neal McBurnett created STEVE-54:
-----------------------------------

             Summary: circular dependencies in setup.py: cannot import name election
                 Key: STEVE-54
                 URL: https://issues.apache.org/jira/browse/STEVE-54
             Project: Steve
          Issue Type: Bug
         Environment: Linux, Ubuntu Bionic

 
            Reporter: Neal McBurnett


Trying to run Steve in cli mode, I take the current code from the git mirror, commit 55ec041 2019-04-01 Return candidates on short-circuitings.

I change to "dbsys: file" in steve.cfg, and run setup:
{code:java}
$ python ./setup.py
Reading steve.cfg 
Traceback (most recent call last): 
 File "./setup.py", line 36, in <module>
 from lib import election, voter, constants 
 File "/srv/s/ranked-choice/steve/lib/election.py", line 31, in <module>
 import constants, voter 
 File "/srv/s/ranked-choice/steve/lib/voter.py", line 31, in <module>
 from lib import constants, election
ImportError: cannot import name election{code}
This seems related to the circular dependency on imports described here: [https://stackoverflow.com/questions/9252543/importerror-cannot-import-name-x]

since importing voter is trying to import election which is in the process of being imported.

A similar import loop arises when I try to fix another bug in files.py, by importing election, since I otherwise get
{code:java}
$ ./tally.py -e /tmp/e -i /tmp/e
Traceback (most recent call last):
File "./tally.py", line 63, in <module>
votes = election.getVotes(args.election, args.issue)
File "/srv/s/ranked-choice/steve/lib/election.py", line 74, in getVotes
return backend.votes_get(electionID, issueID)
File "/srv/s/ranked-choice/steve/lib/backends/files.py", line 86, in votes_get
rvotes = election.getVotesRaw(electionID, issueID)
NameError: global name 'election' is not defined

{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)