cancel
Showing results for 
Search instead for 
Did you mean: 

iPython used for Flat file tagging

Jump to solution

We are looking to increase our effiecency in tagging the managed devices in the environment we manage.  To that end we are wanting to run a python script that will take a flat file list of systems and tag them, which will then run an associated Client Task.  I have created the script and been testing it relentlessly for a couple weeks as well as searching on line for an answer, but have not found one yet. I have included my script below:

-------------------------------------------------------------

import mcafee

mc = mcafee.client ('eposerver','port',username,'password!')

file = open('C:\Anaconda\Scripts\Tagme.txt', 'r')

for line in file:
 mc.system.applyTag(line.rstrip('\n'), 'M.Kirby_test_tag')

--------------------------------------------

When I run the script it imports the mcafee.py and runs the mcafee.client line but stops with an ioerror on the file = open line.  Exact error is:

IOError: [Errno 2] No such file or directory: 'C:/Anaconda/Scripts/Tagme.txt

I have confirmed the script is in the location specified, and spelling is the same.  Also that it is in the same location as the script I am running, so it really doesn't need to look anywhere else. 

If anyone has any information as to what a novice programmer and terrible scripter (me) can do to get this working please help. 

 

 

1 Solution

Accepted Solutions
Highlighted

Re: iPython used for Flat file tagging

Jump to solution

I have been able to resolve this.

 

it came down to my own typing and saving of the file with the systems we wanted to tag.  When i saved the file i wanted to make sure that it was a .txt file.  To that end I named the file and added .txt to the endo f it.  This made it a file.txt.txt and that was not able to be found.  When I removed the .txt in the file name that i added, the script worked and the test systems were tagged with my script. 

1 Reply
Highlighted

Re: iPython used for Flat file tagging

Jump to solution

I have been able to resolve this.

 

it came down to my own typing and saving of the file with the systems we wanted to tag.  When i saved the file i wanted to make sure that it was a .txt file.  To that end I named the file and added .txt to the endo f it.  This made it a file.txt.txt and that was not able to be found.  When I removed the .txt in the file name that i added, the script worked and the test systems were tagged with my script. 

More McAfee Tools to Help You

Community Help Hub

    New to the forums or need help finding your way around the forums? There's a whole hub of community resources to help you.

  • Find Forum FAQs
  • Learn How to Earn Badges
  • Ask for Help
Go to Community Help

Join the Community

    Thousands of customers use the McAfee Community for peer-to-peer and expert product support. Enjoy these benefits with a free membership:

  • Get helpful solutions from McAfee experts.
  • Stay connected to product conversations that matter to you.
  • Participate in product groups led by McAfee employees.
Join the Community
Join the Community