0

I have a python file that does something. It calls into methods from a .pyc file as follows.

someFile.py

# do something 

from EvaluateT.read_input_data import *
print "imported"

# do something 

inputData = ReadInputData(someInputFile)
print "read"

# do something 

When I call the interpreter and type the following statements,

import read_input_data
help (read_input_data)

I see the following output:

CLASSES
     ReadInputData

class ReadInputData
 |  Methods defined here:
 |  
 |  __init__(self, inputFile)
 |  
 |  read_input_data(self)

But, when I run someFile.py, the output prints 'imported' and ignores everything after the 'inputData = ReadInputData(someInputFile)' statement. Why is this statement failing? What am I doing wrong?

  • 2
    I doubt this has anything to do with a Python bytecode cache file. What is `read_input_file` and what do you have in `read_input_data` (note, two different names!) – Martijn Pieters Apr 30 '15 at 16:20
  • @MartijnPieters: That was a typo. I just fixed it. I import the read_input_data.pyc but unfortunately can't access methods within it. Any idea what's going wrong? – Chaitra Raghunath Apr 30 '15 at 16:56
  • `print` statement followed by indentation, after import statement ? – ZdaR Apr 30 '15 at 16:57
  • @anmol_uppal: fixed it. All statements after the 'inputData = ReadInputData(someInputFile)' is ignored – Chaitra Raghunath Apr 30 '15 at 16:59
  • 1
    @ChaitraRaghunath: if the code hangs on `ReadInputData(someInputFile)` then all we can do is guess. Something causes `ReadInputData.__init__()` not to return. Without source code there is nothing we can do to help here. – Martijn Pieters Apr 30 '15 at 17:00

1 Answers1

0

I installed uncompyle2 to decompile my .pyc file to a .py file. It was making use of numpy and scipy which were not installed correctly. I reinstalled the required packages and it works fine now!