Skip to content

Commit 6ef4bc2

Browse files
author
Dilawar Singh
committed
old command line executing and new module based executing are working
fine with python2 and python3 locally.
1 parent c273946 commit 6ef4bc2

4 files changed

Lines changed: 15 additions & 8 deletions

File tree

__main__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
__email__ = "dilawars@ncbs.res.in"
1111
__status__ = "Development"
1212

13-
from FindSim import findSim
14-
from FindSim import runAllParallel
1513

1614
def run():
15+
from FindSim import findSim
1716
findSim.main()
1817

1918
def run_parallel():
19+
from FindSim import runAllParallel
2020
runAllParallel.main()
2121

2222
if __name__ == '__main__':

requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
numpy
22
matplotlib
33
networkx
4+
pymoose
5+
mpld3
6+
scipy

runAllParallel.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
directory, computes their scores, and prints out basic stats of the scores.
3636
It can do this in parallel using Python's multiprocessing library.
3737
'''
38+
from __future__ import print_function, division
3839

39-
from __future__ import print_function, division, absolute_import
4040
import numpy
4141
import argparse
4242
import os
@@ -45,13 +45,16 @@
4545
import time
4646
from multiprocessing import Pool
4747

48-
# Python's pain (import and scripts). See https://stackoverflow.com/a/49480246/1805129
48+
# Python 2/3 pain (import and scripts). See https://stackoverflow.com/a/49480246/1805129
4949
# This 'hack' is here to make sure that `python runAllParallel.py` also works
5050
# and described in old documents.
51-
if __package__ is None or __package__ == '':
52-
import findSim
51+
if sys.version_info.major > 2:
52+
if __package__ is None or __package__ == '':
53+
import findSim
54+
else:
55+
from FindSim import findSim
5356
else:
54-
from FindSim import findSim
57+
import findSim
5558

5659
resultCount = 0
5760
def reportReturn( result ):

test.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env bash
22

33
set -e
4+
set -x
45

56
# virtualenv does not require --user
67
PYTHON=$(which python)
@@ -14,7 +15,7 @@ if [ "$PYTHON_VERSION" -eq "27" ]; then
1415
else
1516
# $PYTHON -m pip uninstall matplotlib -y || echo "Failed to remove matplotlib"
1617
$PYTHON -m pip install matplotlib --upgrade
17-
$PYTHON -m pip install --upgrade
18+
$PYTHON -m pip install scipy --upgrade
1819
fi
1920

2021
# travis.yml should install FindSim

0 commit comments

Comments
 (0)