ImportError: No module named abc

Greetings

I created a library function and hope to reuse it
But then i got this error. I search through and read through the forum posts and tried but still could not resolve it.

Finally i just copy an existing file decimal.py and rename it as abc.py and try to import it but it still gives the same error as “ImportError: No module named abc”
However, there wasnt any error for the line comprising of the import decimal. Both files are located in the same folder in pylib
So could someone please kindly point out what am i missing here or where could the problem be?
Would appreciate any kind advise.
Thank you very much
best regards
kwong weng

Can you try a regular import abc? I’ve had issues before when using the from abc import *syntax in Ignition. Ignition doesn’t seem to automatically reload those.

So it’s best to always use a plain import abc and then use abc in your function calls.

1 Like

Thanks for your kind reply
Actually , prior to posting this post in the forum, i had already tried the normal “import abc” but it still gives the same error. Really cannot understand why the existing file “decimal.py” doesnt give an error but when simply duplicating the same file and rename it as abc, it gives an error?

Here is a detail of the error
Traceback (most recent call last):
File “event:actionPerformed”, line 4, in
ImportError: No module named abc

at org.python.core.Py.ImportError(Py.java:304)
at org.python.core.imp.import_first(imp.java:755)
at org.python.core.imp.import_module_level(imp.java:837)
at org.python.core.imp.importName(imp.java:917)
at org.python.core.ImportFunction.__call__(__builtin__.java:1220)
at org.python.core.PyObject.__call__(PyObject.java:357)
at org.python.core.__builtin__.__import__(__builtin__.java:1173)
at org.python.core.imp.importOne(imp.java:936)
at org.python.pycode._pyx915.f$0(<event:actionPerformed>:67)
at org.python.pycode._pyx915.call_function(<event:actionPerformed>)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1275)
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:647)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.runActions(ActionAdapter.java:183)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.invoke(ActionAdapter.java:284)
at com.inductiveautomation.factorypmi.application.binding.action.RelayInvocationHandler.invoke(RelayInvocationHandler.java:55)
at com.sun.proxy.$Proxy29.actionPerformed(Unknown Source)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Ignition v7.9.1 (b2017012511)
Java: Oracle Corporation 1.8.0_111

Would greatly appreciate any kind advise or help in this peculiar issue.
Thank you very much

Thanks
It seems that the error is due to the path
Initially the files are put in the following path
“C:\Program Files\Inductive Automation\Ignition\user-lib\pylib”
But seems like it is not correct

So when the files are put inside this path/folder
“C:\Users\stmuser.ignition\cache\gw192.168.1.2_8088_443_main\C0\pylib”

It is working

Thank you