Reputation: 1
I am using Python 2.7 with Pycharm and I am working on a quite large text files; they are about 3gb in total.
I need to run LDA, PoS tagging, and other feature extraction methods on the data from the file but everytime I test my code, it has to read the file and go through the same process all over again from the beginning.
This is why I often use Jupyter because all the data / variables in previous cells are kept in memory.
Is there any way to do something similar with Pycharm?
For instance, let's say I am adding features to do_some_feature_extraction()
def do_some_feature_extraction(str_list):
# feature extraction 1
# feature extraction 2
str_list = []
with open("some_file.txt", "rb") as f_in:
for line in f_in:
str_list.append(line)
do_some_feature_extraction(str_list)
Let's say, there was an error on "feature extraction 1" and then I fixed it. Then I will run the code again, then there will be another error on "feature extraction 2". Then I will fix it and run the code again from the beginning.
Instead of doing this, can I just set some sort of checkpoint before executing do_some_feature_extraction(str_list)
?
Upvotes: 0
Views: 2267
Reputation: 114038
click the left side of your code ... next to the line number(or where the line number would be if you have them turned off)
a red dot should appear (this is called a breakpoint)...
now run it in debug mode
when you reach your breakpoint you can click the console tab
and then click the interactive terminal button(>_) to work directly with the context of the program
Upvotes: 1