clr issue - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: clr issue (/thread-2530.html) |
clr issue - tbaba83 - Mar-23-2017 hello all. I am new to python and was seeking some help. trying to run the command import clr clr.AddReference("System.Data") but when i write the second line i get AttributeError: module 'clr' has no attribute 'AddReference'. Not sure what i am doing wrong. I just installed pytonnet. Please help. Thanks. RE: clr issue - buran - Mar-23-2017 Please provide your code and the full traceback it produce RE: clr issue - Ofnuts - Mar-23-2017 (Mar-23-2017, 12:16 PM)buran Wrote: Please provide your code and the full traceback it produce .... and make sure your own source code file (or another file in the same directory) is not named "clr.py". RE: clr issue - nilamo - Mar-23-2017 In an interactive session, import clr and then do dir(clr) so you can see what's there... since what you think is there obviously isn't.
RE: clr issue - Larz60+ - Mar-23-2017 As far as I can see, clr does not have a method named AddReference RE: clr issue - sparkz_alot - Mar-23-2017 According to the docs, http://pythonnet.sourceforge.net/readme.html#importing make sure your path to the assemblies are in the sys.path Quote:Python for .NET uses the PYTHONPATH (sys.path) to look for assemblies to load, in addition to the usual application base and the GAC. To ensure that you can implicitly import an assembly, put the directory containing the assembly in sys.path. RE: clr issue - Ofnuts - Mar-24-2017 (Mar-23-2017, 11:15 PM)sparkz_alot Wrote: According to the docs, http://pythonnet.sourceforge.net/readme.html#importing make sure your path to the assemblies are in the sys.path According to the OP the problem isn't in the import but when the code tries to use whatever was imported as clr .
|