xzos / PyZDDE

Zemax/ OpticStudio Extension using Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exception TypeError when running a script more than once

andres333 opened this issue · comments

Hi,

I have an error message when i run a script more than once.

Here the script, as simple as it could be:

# -*- coding: utf-8 -*-
import sys
import os
import matplotlib.pyplot as plt
import pyzdde.zdde as pyz

ln = pyz.createLink()
print(ln.zGetVersion()) # example
ln.close()

And here what is printed in a freshly started iPython console. Two runs are shown:

Python 2.7.11 |Anaconda 4.0.0 (64-bit)| (default, Feb 16 2016, 09:58:36) [MSC v.1500 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.

IPython 4.1.2 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.
%guiref   -> A brief reference about the graphical user interface.

runfile('C:/Users/xxxx/Desktop/Temp/PyzDDE_tests/test_00.py', wdir='C:/Users/xxxx/Desktop/Temp/PyzDDE_tests')
160608

runfile('C:/Users/xxxx/Desktop/Temp/PyzDDE_tests/test_00.py', wdir='C:/Users/xxxx/Desktop/Temp/PyzDDE_tests')
160608
Exception TypeError: "'NoneType' object is not callable" in <bound method PyZDDE.__del__ of PyZDDE(appName='', appNum=1, connection=False, macroPath=None)> ignored

As you can see, I am using Anaconda, Python 2.7, Spyder.

Interestingly this does not happen the first time that I run the code.

I have tried to follow the recommendations in earlier posts ( #40) but it does not seem to have an effect.

I would appreciate any suggestions.

All the best,
andres

I'm not sure what's going on.

Please try running the script in a "dedicated Python console" in spyder [Preferences >> Run >> Console >> Execute in a new dedicated Python console] and see if you can still reproduce the error.

Please do let me know.

Thank you,
Best regards,
Indranil.

Hi Indranil, sorry for the delay.

In a dedicated console this error does not appear. Also, the first time i run it in a non-dedicated console, it does not appear, only from the second time on. that may be the reason why it does not appear on a dedicated console.

Best & thanks.
Andrés