PyCharam AddReferenceToFileAndPath Attribute Error - python

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.

Related

Python importing ActiveX DLL issue

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!

module object has no attribute windll from docker container

I am trying to run a python script from within a docker container on windows7.
The python scripts loads a DLL library and calls some functions in it according to the (__stdcall) convention. I am using ctypes in python to call functions. The script is working fine when i run it from python but it is just giving me an error while runned from a docker container.
Loading of the library
dll = ctypes.WinDLL("c:\\weCat3D\\weCat3D\\EthernetScanner\\EthernetScanner")
Error from docker container
AttributeError: 'module' object has no attribute 'windll'
what is the wrong thing I am doing?
Use all lowercase for windll. You can also check whether ctypes directory have windll or not by using print (dir(ctypes)) on your console.
I checked, ctypes contains windll. Check at your end. If not then upgrade your version.
I am coming back to this issue to answer my question. I was trying to call a DLL library from within the docker container system which is containing a Linux image or Layer. That is why my calling convention for the DLL library (Windll) didn't work. I have got the same DLL library in .so (Linux version) and it is working now.

Error when installing module 'message' (AttributeError: module 'message' has no attribute '__all__')

I get the following error when I try to install Python module 'message':
AttributeError: module 'message' has no attribute '__all__'
I would appreciate if someone could help with this problem. Thank you in advance.
Might be a little late to anwser but maybe this will help.
I was getting a similar error message when I was trying to import some modules. The error was:
AttributeError: module 'xxx' has no attribute '__all__'
What I found on the Python issue tracker was this:
That's because there is also a standard library module named token (https://docs.python.org/3/library/token.html). When you run python, by default the current working directory is inserted at the beginning of sys.path, the list of directories searched for modules. If you have a file there that has the same name as a standard library module, e.g. token.py, it will be found first and, thus, "hide" the standard library module of the same name. Either change the name of your file so it does not conflict or make sure it is in a directory not on sys.path.
So the problem here might be that python tries to import a 'message.py' module while you also have a different 'message.py' file somewhere else in your directory.

Importing winappdbg gives ModuleNotFoundError for breakpoint in PyCharm?

Whenever I try to just import winappdbg it gives me an error ModuleNotFoundError: No module named 'breakpoint'. So, I tried installing breakpoint and that gives me another error ModuleNotFoundError: No module named 'ConfigParser' and I've installed configparser several times and still get the error. (Can't find capital ConfigParser) I'm using Windows 10/PyCharm Community Edition 2017.2.3/python 3.6.3
WinAppDbg is only for Python 2.x, it does not work on Python 3.x. Honestly, I had no idea it would even let you import it.
All those import errors are happening not because of missing dependencies (also, no idea there were similarly named modules in pip), they are submodules of WinAppDbg itself. Since Python 3 has a different syntax to specify those, it tries to load them as external modules instead. I suppose you could fix that in the sources by prepending a dot before every submodule import, but I'm guessing more stuff would break down the road (string handling for example is radically different and that would affect the ctypes layer).
TL;DR: use Python 2.x.

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

Categories