Hi =) I understand that I can run an ipython debugger and set a breakpoint at the command line, e.g.
%run -d -b12 convert_excel.py
However, I am unable to get Spyder (version 5.4.3) to recognise the -b12
command.
An example script to reproduce this problem is
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 14 18:12:11 2023
@author: jonathan
Convert CPIC excel files into text files
"""
import pandas as pd
INPUT_FOLDER = 'raw_excel'
FILE = 'raw_excel/test.xlsx'
df_dict = pd.read_excel(FILE, index_col=0, sheet_name=None)
for key in df_dict:
if 'CDS' in df_dict[key].columns.str.cat(sep = ' '):
drug_df = df_dict[key]
output = FILE.split('/')[-1].split('.')[0] + '.txt'
drug_df.to_csv(output, sep='\t')
When I run this code %run -d -b12 convert_excel.py
, my breakpoint is ignored. The below is what I see:
In [9]: %run -d -b12 convert_excel.py
Breakpoint 1 at c:\users\jonat\documents\machine_learning\genetic_pipeline\convert_excel.py:12
NOTE: Enter 'c' at the ipdb> prompt to continue execution.
> c:\users\jonat\documents\machine_learning\genetic_pipeline\convert_excel.py(2)<module>()
1 # -*- coding: utf-8 -*-
----> 2 """
3 Created on Fri Apr 14 18:12:11 2023
4
5 @author: jonathan
IPdb [1]: b
IPdb [2]: c
C:\Users\jonat\anaconda3\lib\site-packages\openpyxl\styles\stylesheet.py:226: UserWarning: Workbook contains no default style, apply openpyxl's default
warn("Workbook contains no default style, apply openpyxl's default")
If I set the breakpoint directly in ipython, instead of setting it with the %run
command, it works:
In [12]: %run -d convert_excel.py
*** Blank or comment
*** Blank or comment
*** Blank or comment
NOTE: Enter 'c' at the ipdb> prompt to continue execution.
> c:\users\jonat\documents\machine_learning\genetic_pipeline\convert_excel.py(2)<module>()
1 # -*- coding: utf-8 -*-
----> 2 """
3 Created on Fri Apr 14 18:12:11 2023
4
5 @author: jonathan
IPdb [1]: b 12
Breakpoint 1 at c:\users\jonat\documents\machine_learning\genetic_pipeline\convert_excel.py:12
IPdb [2]: b
Num Type Disp Enb Where
1 breakpoint keep yes at c:\users\jonat\documents\machine_learning\genetic_pipeline\convert_excel.py:12
IPdb [3]: c
> c:\users\jonat\documents\machine_learning\genetic_pipeline\convert_excel.py(12)<module>()
10 import pandas as pd
11
1--> 12 INPUT_FOLDER = 'raw_excel'
13 FILE = 'raw_excel/fluvastatin_Pre_and_Post_Test_Alerts.xlsx'
14
May I know why doesnt Spyder recognise the b
command in %run
and how do I fix this?