As you may remember, a couple months ago I was working on using iPython to take a flat file of systems and tag them. I did get it working. It was around the middle of February. So I was asked to revisit this and write a guide for future users so they too could create and use flat files. When I came back to this task I found that the script i wrote that was working, no longer functions. There have been no changes from my end, and the person who tested this script is a power user/administrator in the environment so he should have no problems running this. Here is what I have done so far:
My script is in the following format.
mc = mcafee.client ('mnap3663','9597','username','password')
file = open('Tagme.txt', 'r')
for line in file:
I am at a loss for how or why it would stop working, when nothing has changed. Any ideas are welcome and appreciated.
MMore information or fuel to add to the fire.
I am still working on getting my script functioning again. Here is what I have found when I use the Spyder Debugging tool.
When I run the script it stops at this line : file = open('Documents\Tag_me_test.txt', 'r') If does not matter if it is the full location or just what I have displayed. I get a message on the Console window (to the right) that reads : runfile('C:/Users/michael.kirby/Documents/Test_tag_Script.py', wdir='C:/Users/michael.kirby/Documents')
File "C:\Users\michael.kirby\Documents\mcafee.py", line 283
except KeyError, e:
SyntaxError: invalid syntax
So I go back to the mcafee.py and try removing the comma, replacing the comma with a semi colon and even adding a backslash after the e: but nothing.
This is the mcafee.py that comes with the iPython tool so it is not a manually created script.
After further investigating, I have found that the version of Anaconda / iPython installed on my system is 4.3.1, which was installed Feb 8th 2018. If i am correct the version of the mcafee.py and urlquote.py that I was given on Feb 5th by the department controlling the software rollout was 2.7.3. If that is the case, do i have a compatability issue between the two and that is why when i run the Jupiter Notebook and or the Sypder debugging tool that it cannot find the mcafee.py or has a problem with that on line 283?
Thanks for looking. Any response may lead to a full resolution.
I am still working my way through this. Here is where we stand at the moment.
If i use mcafee_epo.py (which was a script I found not sure where at the moment) I can get past the autnentication and it will run right up to thelast line where it needs to actually tag the systems listed in the flat file. It then gives the message of " AttributeError: 'Client' object has no attribute 'System' ".
So I tried to use the mcafee.py script that I updated using 2to3.py, which is a part of the Python v,3 product that basically updates older script to woirk with the new version of Python. The mcafee.py was successfully updated, and when i use that as the import mcafee, and then direct it to the epo server it spits out that it cannot authenticate. a 401 authentication message. I have trie both the server name as well as the IP address, plus as the same line authenticates with the mcafee_epo.py, it should authenticate with this.
Please help this has gone on far too long.
I am also experiencing this same issue. What is your server version?
our previous server uses windows server 2012 and my python script to apply tags works fine however upon migrating to windows 2016, the script does not work anymore.
Try the latest 2.7.1 or higher version of python. See if KB90056 applies.
Was my reply helpful?
If this information was helpful in any way or answered your question, will you please select Accept as Solution in my reply and together we can help other members?
Hi I have installed Python version 2.7.15 and upon testing the apply tag script i received this error:
Traceback (most recent call last):
File "C:\Users\Username\Desktop\Python\TEST.py", line 4, in <module>
file = open('C:\Users\Username\Desktop\Python\test.txt', 'r')
IOError: [Errno 22] invalid mode ('r') or filename: 'C:\\Users\Username\\Desktop\\Python\test.txt'
Still our script whenever we use it in our 2012 server works just fine.