pycharm cannot run script but can debug it
I have run into a similar error running caffe on pycharm. I think it's because of the version of Python. When I installed Python 2.7.13, it worked!
When I ran a script in PyCharm, it exited with:
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA   library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcurand.so locally
DEBUG:tm._add: /joy, sensor_msgs/Joy, sub
Fatal Python error: (pygame parachute) Segmentation Fault
Process finished with exit code 134 (interrupted by signal 6: SIGABRT)

But when I debug it in PyCharm, the program ran without any problem. 
Also, if I ran the script in ubuntu terminal, no problem occurs, too. Why does this happen, or how can I debug this problem?