0

Although this involves a Drupal site, the question is more at the server level, I think.

BACKGROUND: Site uses modules "Election" and "Election OpenSTV Integration, the latter one being involved in counting votes from the election. It must link to "OpenSTV" code, a set of apps which run in Python, which must also be installed on the server.

PROGRESS SO FAR: The whole system was set up on a local Mac-based dev site, using the Mac version of Python and linking to the OpenSTV code on that computer. Election counting worked.

NEW ENVIRONMENT REQUIRED for Production Site: The site was migrated (actually, re-created) on the Windows IIS server where it needs to reside. All needed modules were installed, a Windows version of Python was installed, and the OpenSTV code directories were installed. The one remaining step is that the "Elections OpenSTV Integration" module needs to be given a valid path to a file "runElection.py" which is within the same set of directories as used in the Mac environment.

THE PROBLEM: A path must be provided in a config field for the OpenSTV Integration module. The path that worked in the Mac environment was:

/Users/myname/Documents/openstv-master/openstv/runElection.py

In the Windows IIS environment, after much trial and error we found a path syntax that saves and does not generate a "cannot be executed" error as we were getting in earlier attempts. That path is:

C:\Python34\python.exe C:\inetpub\wwwroot\naccas-elections\sites\all\libraries\openstv-master\openstv/runElection.py

We had assumed if it doesn't generate the "cannot be executed" error, there must not be any problem with either the path or permissions to execute.

However when I am logged in with appropriate permissions and go to the site's OpenSTV tab (in a test election which has some votes recorded) and try to export results, what I get suggests it's not working. In the localized Mac dev site, I could choose to export HTML and would get a zipped folder of HTML files which displayed as expected. In this production version on the IIS server, the same export command does generate a .zip file – but attempts to unzip it generate another single file of the form "SandBox-Election-SNTV-HtmlReport.zip.cpgz" – so, appending ".cpgz" to the original export.

What could be going wrong in this case? Is there any reason why the OpenSTV code (v. 1.7) wouldn't run in the Windows IIS server environment, even though a compatible Python version is installed? Is there an alternative to consider?

To provide context: The image below shows the configuration field as presented by the OpenSTV Integration module; what's in the field is just a default: screenshot of OpenSTV Integration config dialogue

migrated from drupal.stackexchange.com Jul 16 '14 at 14:56

This question came from our site for Drupal developers and administrators.

  • Maybe I'm missing something, but how is it directly Drupal-related? – Mołot Jul 14 '14 at 6:56
  • A valid point. It's related to trouble getting a Drupal module to work, but ultimately it is more of a server path and/or permissions problem. Would I be able to either move it to another forum, or duplicate the question there? – Charles Jul 15 '14 at 21:24
  • Don't duplicate, it's forbidden in Stack Exchange network. To move, you can flag using "other (needs ♦ moderator attention)" reason, and there ask for moderator's guidance. It may be on-topic here, Drupal-related server issues are, I just think that it might be hard to get answers here, because most of your problems seems to be with py files and Drupal "just happens" to use them. – Mołot Jul 16 '14 at 6:22
  • \openstv/runElection.py Shouldn't this be \openstv\runElection.py ? – Simon Hayter Jul 16 '14 at 15:51
  • bybe, that makes sense to me. This path was provided by the hosting service tech person and it saves without error; using the "\" produced an error... Oddly, now just trying it again, the backwards slash (making all consistently backward-slashed) does not produce the same error as before. However, although it does not generate a "cannot execute" error, the function still does not work when used from the site module's interface. Looks like I need to verify that the Python script can be run directly, rather than from the site module's function, just to verify that this is not the problem. (How?) – Charles Jul 16 '14 at 17:31
1

The problem has been solved. The Python script "OpenSTV / runElection.py" was not running because Python 3.4 was installed, and this script wasn't written to run in this version. Going back to Python 2.7.8 solved the problem. The clues, although not specific to version problems, were in the Drupal site's log messages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.