spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.34k stars 1.62k forks source link

debug then kernel stop #13840

Open Laivetta opened 4 years ago

Laivetta commented 4 years ago

Description

What steps will reproduce the problem?

when i tried to debug a program, the kernel stop

Versions

Dependencies


# Mandatory:
atomicwrites >=1.2.0           :  1.4.0 (OK)
chardet >=2.0.0                :  3.0.4 (OK)
cloudpickle >=0.5.0            :  1.6.0 (OK)
diff_match_patch >=20181111    :  20200713 (OK)
intervaltree                   :  None (OK)
IPython >=4.0                  :  7.18.1 (OK)
jedi =0.17.1                   :  0.17.1 (OK)
nbconvert >=4.0                :  5.6.1 (OK)
numpydoc >=0.6.0               :  1.1.0 (OK)
paramiko >=2.4.0               :  2.7.2 (OK)
parso =0.7.0                   :  0.7.0 (OK)
pexpect >=4.4.0                :  4.8.0 (OK)
pickleshare >=0.4              :  0.7.5 (OK)
psutil >=5.3                   :  5.7.2 (OK)
pygments >=2.0                 :  2.7.1 (OK)
pylint >=1.0                   :  2.6.0 (OK)
pyls >=0.34.0;<1.0.0           :  0.35.1 (OK)
qdarkstyle >=2.8               :  2.8.1 (OK)
qtawesome >=0.5.7              :  0.7.2 (OK)
qtconsole >=4.6.0              :  4.7.6 (OK)
qtpy >=1.5.0                   :  1.9.0 (OK)
rtree >=0.8.3                  :  0.9.4 (OK)
sphinx >=0.6.6                 :  3.2.1 (OK)
spyder_kernels >=1.9.4;<1.10.0 :  1.9.4 (OK)
watchdog                       :  None (OK)
zmq >=17                       :  19.0.2 (OK)

# Optional:
cython >=0.21                  :  0.29.21 (OK)
matplotlib >=2.0.0             :  3.3.1 (OK)
numpy >=1.7                    :  1.19.1 (OK)
pandas >=0.13.1                :  1.1.1 (OK)
scipy >=0.17.0                 :  1.5.0 (OK)
sympy >=0.7.3                  :  1.6.2 (OK)
Laivetta commented 4 years ago

when i try to debug a file in python, the kernel stop and restart, every time

Laivetta commented 4 years ago

[SpyderKernelApp] WARNING | No such comm: 062ae948fd3211eaa90800090ffe0001

Laivetta commented 4 years ago

[SpyderKernelApp] WARNING | No such comm: 062ae948fd3211eaa90800090ffe0001 [SpyderKernelApp] WARNING | No such comm: 4dde740dfd3211ea887100090ffe0001 [SpyderKernelApp] WARNING | No such comm: 619e6fe5fd3211ea9c6400090ffe0001 [SpyderKernelApp] WARNING | No such comm: 90498814fd3211eaaf2500090ffe0001

steff456 commented 4 years ago

Hi @Laivetta,

Can you please give me a snippet of code that I can use to try and reproduce your error?

Laivetta commented 4 years ago

Hi Steff, the "warning" i cant reproduce, but the kernel stop is with any code, for example just

var = "hello world" print (var)

Laivetta commented 4 years ago

well, when i tried, can reproduce the error:

`

debugfile('C:/Users/Usuario/Desktop/Python/Pandas/documentacion.py')

Kernel died, restarting

Restarting kernel...

[SpyderKernelApp] WARNING | No such comm: eb40a0f2fd7e11ea9ccc00090ffe0001 [SpyderKernelApp] WARNING | No such comm: f25998bdfd7e11eaaec100090ffe0001 [SpyderKernelApp] WARNING | No such comm: feec2a1dfd7e11eab84800090ffe0001 [SpyderKernelApp] WARNING | No such comm: 0f155d32fd7f11eaa5a200090ffe0001

`

`import os from docx2python import docx2python import PyPDF2

""" ------------------ PDF ---------------------"""

archivo_pdf = open('1.pdf', 'rb') pdfReader = PyPDF2.PdfFileReader(archivo_pdf) num_page_pdf = pdfReader.numPages print(num_page_pdf) archivo_pdf = []

for p in range(num_page_pdf): pageObj = pdfReader.getPage(p) print("esto es pdf ...:" , archivo_pdf, "\n " , pageObj.extractText())

""" ------------------- DIRECTORIO ------------------------"""

breakpoint()

root = 'C:/Users/Usuario/Desktop/Python/Pandas'

root = 'C:/Users/Usuario/Desktop/Trabajo Pa/Cierre BI cero 25841 y 26292/6 prueba'

files = [f for f in os.listdir(root) if os.path.isfile(f)]

directorios = [f for f in os.listdir(root) if os.path.isdir(f)]

directorios=[] for x in os.listdir(root): if not os.path.isdir(x): directorios.append (x)

print ("cantidad archivos. :", len(files), "--------", "archivos -->: ",files)

print ("directorios -> ", directorios, "\n")

for x in directorios:

dir1 = root + "/" + x
archivos = []
for y in os.listdir(dir1):
    if os.path.isfile(dir1 + "/" + y):
        archivos.append(y)

        buscados = "doc"
        encontrados = [i for i in archivos if buscados in i]
        print("archivos de word" , encontrados)
        for d in encontrados:
            file = dir1 + "/" + d
            text = docx2python(file)
            print (text.body)

print("el directorio es ->" , x, " --------- " "los archivos son -> ", archivos)

#

""" ------------------- WORD ------------------------"""

file = 'C:/Users/Usuario/Desktop/Python/Pandas/.idea/1.doc'

text = docx2python(file) print (text.body) #

print(text.header)

if text.images != 0: print ("tiene imagenes pegadas") # #

"""extre las imagenes pegadas de word"""

#

for key,val in text.images.items():

f = open(key, "wb")

f.write(val)

f.close()

# # `

Laivetta commented 4 years ago

Sorry for the previus msg, I clean the code:

import os
from docx2python import docx2python
import PyPDF2

""" ------------------ PDF ---------------------"""

archivo_pdf = open('1.pdf', 'rb')
pdfReader = PyPDF2.PdfFileReader(archivo_pdf)
num_page_pdf = pdfReader.numPages
print(num_page_pdf)
archivo_pdf = []

for p in range(num_page_pdf):
    pageObj = pdfReader.getPage(p)
    print("esto es pdf ...:" , archivo_pdf, "\n " , pageObj.extractText())

""" ------------------- DIRECTORIO ------------------------"""
# breakpoint()
#root = 'C:/Users/Usuario/Desktop/Python/Pandas'
root = 'C:/Users/Usuario/Desktop/Trabajo Pa/Cierre BI cero 25841 y 26292/6 prueba'

# files = [f for f in os.listdir(root) if os.path.isfile(f)]
# directorios = [f for f in os.listdir(root) if os.path.isdir(f)]

directorios=[]
for x in os.listdir(root):
    if not os.path.isdir(x):
        directorios.append (x)

# print ("cantidad archivos. :", len(files), "--------", "archivos -->: ",files)
# print ("directorios -> ", directorios, "\n")

for x in directorios:

    dir1 = root + "/" + x
    archivos = []
    for y in os.listdir(dir1):
        if os.path.isfile(dir1 + "/" + y):
            archivos.append(y)

            buscados = "doc"
            encontrados = [i for i in archivos if buscados in i]
            print("archivos de word" , encontrados)
            for d in encontrados:
                file = dir1 + "/" + d
                text = docx2python(file)
                print (text.body)

    print("el directorio es ->" , x, " --------- " "los archivos son -> ", archivos)

#
# #
# """ ------------------- WORD ------------------------"""

file = 'C:/Users/Usuario/Desktop/Python/Pandas/.idea/1.doc'

text = docx2python(file)
print (text.body)
#
# print(text.header)

if text.images != 0:
    print ("tiene imagenes pegadas")

#
#
# """extre las imagenes pegadas de word"""
#
# for key,val in text.images.items():
#     f = open(key, "wb")
#     f.write(val)
#     f.close()
steff456 commented 4 years ago

Can you please upload a gif with the behavior you are having while debugging?

Laivetta commented 4 years ago

spyder

Well, the "warmings" is random, but the kernel died is always

ccordoba12 commented 4 years ago

Hey @Laivetta, this seems a problem with your code or a bug in the libraries you're using on it, not an issue with Spyder.

Are you able to run it outside Spyder? For instance in a Jupyter notebook or in a terminal with python my_file.py? (my_file stands for the name of your file).

Laivetta commented 4 years ago

I run my code in a terminal and run ok. The code run ok in spyder. The problem is when i tried to run in debug way . The gif that i send is when i tried to debug

ccordoba12 commented 4 years ago

Ok, thanks for the clarification. I reformatted your code above (I hope that's ok), but it's not possible for us to run it because it depends on external files we don't have.

Could you also upload 1.pdf and 1.doc? If it's not possible here, pleas try to do that somewhere else.

Laivetta commented 4 years ago

Ok no problem. Now its late. Tomorrow in the morning. But this problem was with diferent code. Hello World not Work too.

ccordoba12 commented 4 years ago

Ok no problem. Now its late. Tomorrow in the morning.

Thanks for your help!

Hello World not Work too.

What do you mean by this?

Laivetta commented 4 years ago

Here are the files. Remember, the problem is with the Debug Mode files.zip

ccordoba12 commented 4 years ago

@steff456, please try to reproduce @Laivetta's problem on Windows.