0

I am a newbie with Python and I always run scripts with terminal. Now I would like to run and debug using PyCharm. I have this script:

#  -*- coding: utf-8 -*-

matplotlib.use('Agg')
import sys
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import os
import math
import time
from time import sleep
import fpformat
sys.path.append("/Users/myname/OneDrive - UCL/my_folder/build")
from my_module_name import example

When I run the script with terminal everything works. When I use PyCharm I have this:

/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 "/Users/myname/OneDrive - UCL/my_folder/Simulations/S16/03/04_Command_compacity/8.Compact_resistance.py"
Fatal Python error: PyThreadState_Get: no current thread

The problem is here:

sys.path.append("/Users/myname/OneDrive - UCL/my_folder/build")
from my_module_name import example

I have to use this module for my master thesis and if I remove these two lines I can run other scripts, but I can't run scripts that use this module. Could you help me? Thank you!

Jourasky
  • 53
  • 5
  • Is `gmshutils` specifically imported in `my_module_name`? Where does `gmshutils` reside? For example, if it was installed in the current directory then that is often something which is different in an IDE. – cdarke Apr 09 '18 at 08:23
  • @cdarke I don't use that module, so that info is ok. Thanks, I forgot to remove that line from my post. I edit it. – Jourasky Apr 09 '18 at 08:29
  • Possible duplicate of [What does \`Fatal Python error: PyThreadState\_Get: no current thread\` mean?](https://stackoverflow.com/questions/35640529/what-does-fatal-python-error-pythreadstate-get-no-current-thread-mean) – cdarke Apr 09 '18 at 08:35
  • `In other words, you have more than one version of python installed and Pycharm is picking-up the wrong one. – cdarke Apr 09 '18 at 08:59

1 Answers1

0

I typed

which python

in terminal and I changed the directory in the Python Interpreter settings

Jourasky
  • 53
  • 5