steve-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Neal McBurnett (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (STEVE-54) circular dependencies in setup.py: cannot import name election
Date Sat, 13 Apr 2019 18:18:00 GMT

    [ https://issues.apache.org/jira/browse/STEVE-54?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16817036#comment-16817036
] 

Neal McBurnett commented on STEVE-54:
-------------------------------------

OK, it looks like the first part of this issue is a dup of 
 # STEVE-30

But the second part is still there: and the bug in files.py: 
NameError: global name 'election' is not defined
doesn't seem to be reported elsewhere.

For the CLI it would also be very helpful to provide sample ELECTION and ISSUE files for testing,
and to document the formats if possible.

> 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
>            Priority: Major
>
> 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)

Mime
View raw message