Python importing ActiveX DLL issue - python

This will be my first question.
I am trying to use python to import a SDK which provides ActiveX DLL and ocx file.
I tried using
clr.FindAssembly(“dllname.dll”)
clr.AddReference(“dllname”)
to load while I have error showing:
System.IO.FileNotFoundException: Unable to find assembly 'MyDLL'
Python.Runtime.CLRModule.AddReference(String name)
Then I tried using
ctypes.WinDLL(‘dllname.DLL’)
But I cannot find any functions inside of it.
Can anyone tried to provide any ideas?
Many thanks!

Related

TA-LIB module has no attribute 'add_all_ta_features'

I'm trying to use TA-lib for a hobby project. I found some code-snippets as reference telling me to do the following;
import talib as ta
ta.add_all_ta_features("some parameters here")
i get the following error when running the code:
ta.add_all_ta_features( AttributeError: module 'talib' has no attribute 'add_all_ta_features'
It looks like i need to manualy add all the features i want as i cant find the attribute .add_all_ta_features in the talib folder.
i've installed TA-Lib and made it a 64-bit library using Visual studio and managed to run TA-Lib in other projects before but have never used the .add_all_ta_features-attribute.
Does anybody know how i can fix this? Google seems to not return any usefull results when searched for this. The documentation i'm following also does not mention anything about this attribute.
i tried using pandas_ta and tried using the Google colab space, but both return the same error.
Found the problem. I was trying to use TA-Lib as TA, but nowhere was it specified that we need a seperate library, not findable through the python package mangager simply called TA.
Thanks!

PyCharam AddReferenceToFileAndPath Attribute Error

I am trying to access C# DLL using PyCharm. I am able to access the same DLL using IronPython.
Now, I want to access that DLL in pycharm and develop script.
import clr
clr.AddReferenceToFileAndPath(r"C:Calculation.dll")
I am getting AttributeError: module 'clr' has no attribute 'AddReferenceToFileAndPath' Error
The issue here is that the guide you are following has a custom built, local module called clr.
The PyPi clr package is used to edit console string appearances.
In order to fix this, you will need to obtain the custom-built "clr" module provided by the author.

win8.1 64 bit + python 2.7.3 + import htql; ImportError: DLL load failed: The specified module could not be found

This is the first time to use python and need to import htql
when i run this code:
import htql;
page="<a href=a.html>1</a><a href=b.html>2</a><a href=c.html>3</a>";
query="<a>:href,tx";
for url, text in htql.HTQL(page, query):
print(url, text);
i got the following error:
import htql; ImportError: DLL load failed: The specified module could not be found.
error screenshot
i trys to to solve error as refered here ImportError: DLL load failed: The specified module could not be found
BUT error still exists!!
Also i am Installing the Visual C++ Redistributable für Visual Studio 2015 from this links: https://www.microsoft.com/de-at/download/details.aspx?id=48145
to fix the missing DLLs
BUT error still exists!
Please help!
THNAKS IN ADVANCE ..
The problem of the questioner is he followed installation instructions from HTQL PDF-manual named Hyper-Text Query Language COM Interface, which obviously describes library setup for COM (Component Object Model by Microsoft), proposing regsvr32 <path-to-dll>. Intended to be used within win32-infrastructure aware applications first place
While there are means to use COM from within python (e.g. via pywin32 and others), it's not common method python script expects.
Proper solution is to follow instructions from HTQL home page, suggesting:
Windows binaries: Download the htql.zip and extract "htql.pyd" to the Python's DLLs directory, such as in 'C:\Python27\DLLs\' or 'C:\Python32\DLLs\'.
to install precompiled python .pyd module within python libraries search path

Python for .Net Error: ImportError: No module named

We are using Python for .Net to call .NET API built using C# from Python script.
We are getting ImportError: No module named - error when an import is done as follows.
Python script:
import sys
sys.path.append(r"C:\myfolderA\myfolderB")
print sys.path
import clr
clr.FindAssembly(r"AA.BB.CC")
clr.AddReference(r"AA.BB.CC")
from AA.BB.CC.Api.DDInterface import DDClient
On the above line I am getting following error
Traceback (most recent call last):
File "C:\myfolderA\myfolderB\testAPI.py", line 7, in <module>
from AA.BB.CC.Api.DDInterface import DDClient
ImportError: No module named AA.BB.CC.Api.DDInterface
There is no other information available to exactly identify the issue.
Dlls from same project built 15 days back works fine.
This project may have gone through few changes in between.
How to exactly identify this issue?
Could this be a dependency issue?
I tried JustDecompile to compare old dlls and new ones, but couldn't find anything unusual.
Your help is deeply appreciated.
Thanks,
With help from python forum I was able to use Microsoft's Fuslogvw.exe (Assembly Binding Log Viewer) and figure out the dependent dll causing the error.
Thanks
Here is a link to my original answer:
https://mail.python.org/pipermail/pythondotnet/2014-December/001626.html
I recommend using Assembly Binding Log Viewer (fuslogvw.exe) for
corresponding .NET framework to see the log files of loading assemblies.
Set Log Location as Custom and in Settings point to your assemblies folder.
The log should show the sequence of DLLs being loaded and any errors.
This worked for me, see here:
Could not load file or assembly or one of its dependencies
Can't locate fuslogvw.exe on my machine

import Error while importing python nltk module in node.js using "python-node" module

I am trying to import python natural language processing toolkit nltk in node.js using node-python mentioned here: https://npmjs.org/package/node-python
The commands i am giving are similar as mentioned on the npm module site:
var python = require('node-python');
var os = python.import('os');
i am getting the following error:
Error: /usr/lib/python2.7/lib-dynload/datetime.so: undefined symbol: PyExc_SystemError
at repl:1:25
at REPLServer.self.eval (repl.js:109:21)
at rli.on.self.bufferedCmd (repl.js:258:20)
at REPLServer.self.eval (repl.js:116:5)
at Interface.<anonymous> (repl.js:248:12)
at Interface.EventEmitter.emit (events.js:96:17)
at Interface._onLine (readline.js:200:10)
at Interface._line (readline.js:518:8)
at Interface._ttyWrite (readline.js:736:14)
at ReadStream.onkeypress (readline.js:97:10)
I am using python2.7.2
After much search i found that this is a known bug in python2.7 and found a similar problem when importing from C here is the what i found:
similar error found while importing python datetime module from C
The problem seems to be in the datetime.so module, i was thinking of getting the updated version of the datetime module and compiling it separately to make it work. I am still looking for that module and comple instructions. I would really appreciate If anyone has a better suggestion to resolve this or even help me locate the place to find this datetime module and its compile instructions. I really don't want to compile the whole python to make it work.

Categories