Pycharm doesn't print

import numpy as np
from scipy import misc

def CatvsDogClassifier():
print("Loading images for training ")

X = np.zeros(750000, 80000)
Fd = open("C:\\Users\Gianluca\Desktop\kittens\dataset\\training_set\dogs", "r")
Fc = open("C:\\Users\Gianluca\Desktop\kittens\dataset\\training_set\cats", "r")
for line in Fd:
arr=np.zeros(500, 500, 3)
image = 'C:\\Users\Gianluca\Desktop\kittens\dataset\\training_set\cats\\'+line
arr = misc.imread(image)
X = np.hstack((X[:, :i], arr, X[:, i:]))
print (X)
if __name__=='__main__':

I try to execute this code but nothing is printed, only the return with exitcode0. If i remove
the modules fromt the interpreter it works. Is there a way to fix this?

>If i remove the modules fromt the interpreter it works.

Which modules do you mean?

You do not call the __main__ function which calls CatvsDogClassifier function, so isn't it expected then that the function isn't executed?


I updated my code because the error was not responsible for my problem. The modules are numpy and scipy. 


Please try running it from the system terminal (outside of PyCharm) using the same interpreter. Do you have the same problem?

If not, would be great to have screenshots showing successful execution in terminal and the problem when running from PyCharm.


From the terminal it works, from pycharm:



apart from errors in code, the print of "Loading images for training works"


You are not running the same file. That's because you copied the code and saved in a separate file?

If you add some errors in the code and run it in PyCharm, do you see the print then?

Right now, the experiment doesn't seem to be fair since you use different interpreter and there is also Permission denied error. Would be great to  have identical conditions.


Ok, I don't have the faintest idea of what happened but without any change the code now is running and producing a result.....sorry to have bothered you, I really don't get what wasn't working before.


Please sign in to leave a comment.