Python issue

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Python issue

jbelbute
We are trying to parse some python files and are getting the following results.  We’ve looked at the file and the characters seem to be correct.  We’ve also run the file through pylint and have not seem the file.  Anyone have any ideas

Thanks
john

14:28:57.930 ERROR - Unable to parse source file : /home/jbelbute/ops/salt/_modules/nsutil.py

14:28:57.989 ERROR - Source Snippet:

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

   38             _log_to_salt(response)

   39 returnFalse

   40         except:

   41         response='Failed to load nsutil. '+

   42                  'Netscaler info is not in pillar data ! ' +

   43                  'Please fix it or maybe this is wrong host to run'

   44 _log_to_salt(response)

  -->         returnFalse

   46 

   47 def _get_netscaler_info():

   48     '''

   49     Return Netscaler IP, Username, Password that are stored in Pillar

   50 

   51     The function expects a dictionary like this from pillar data.

   52 

   53     {'netscaler': {'phx-intlb-3':{'ns_ip':'10.59.100.59',

   54                                   'ns_username': 'nitro',

   55                                   'ns_password': 'secret_password'

   56                                   }

   57                   }

   58     }

   59     '''

   60 return__pillar__['netscaler']

   61 

   62 def _get_hostname():

   63     '''

   64     Return hostname where this module is executed.

   65     '''

   66 returnsocket

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


on matcher or(NEWLINE, statement)

      45 :      0  : NEWLINE expected but "        " [INDENT] found

at file_input

       1 :      0  : '''

Salt Module: NetScaler State Change Utility


:maintainer: John Dong <[hidden email]>

:maturity: new

:depends: sys,json,urlib,socket,logging,httplib2,salt.utils.decorators

:platform: Ubuntu

''' 

 import sys ...


Last successful tokens:

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

  "

" at 44:23 consumed by file_input

  ")" at 44:22 consumed by file_input

  "response" at 44:14 consumed by file_input

  "(" at 44:13 consumed by file_input

  "_log_to_salt" at 44:1 consumed by file_input

  " " at 44:0 consumed by file_input

  " " at 44:0 consumed by file_input


Reply | Threaded
Open this post in threaded view
|

Re: Python issue

David Racodon-2
Hi John,

Would it be possible to provide the file (you can send it to me privately)?

Thank you

Regards,


David RACODON | SonarSource
Senior Consultant

---------------------------------------------
  Sign up to our newsletter here!
---------------------------------------------


On Wed, Apr 2, 2014 at 1:32 PM, Belbute, John <[hidden email]> wrote:
We are trying to parse some python files and are getting the following results.  We’ve looked at the file and the characters seem to be correct.  We’ve also run the file through pylint and have not seem the file.  Anyone have any ideas

Thanks
john

14:28:57.930 ERROR - Unable to parse source file : /home/jbelbute/ops/salt/_modules/nsutil.py

14:28:57.989 ERROR - Source Snippet:

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

   38             _log_to_salt(response)

   39 returnFalse

   40         except:

   41         response='Failed to load nsutil. '+

   42                  'Netscaler info is not in pillar data ! ' +

   43                  'Please fix it or maybe this is wrong host to run'

   44 _log_to_salt(response)

  -->         returnFalse

   46 

   47 def _get_netscaler_info():

   48     '''

   49     Return Netscaler IP, Username, Password that are stored in Pillar

   50 

   51     The function expects a dictionary like this from pillar data.

   52 

   53     {'netscaler': {'phx-intlb-3':{'ns_ip':'10.59.100.59',

   54                                   'ns_username': 'nitro',

   55                                   'ns_password': 'secret_password'

   56                                   }

   57                   }

   58     }

   59     '''

   60 return__pillar__['netscaler']

   61 

   62 def _get_hostname():

   63     '''

   64     Return hostname where this module is executed.

   65     '''

   66 returnsocket

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


on matcher or(NEWLINE, statement)

      45 :      0  : NEWLINE expected but "        " [INDENT] found

at file_input

       1 :      0  : '''

Salt Module: NetScaler State Change Utility


:maintainer: John Dong <[hidden email]>

:maturity: new

:depends: sys,json,urlib,socket,logging,httplib2,salt.utils.decorators

:platform: Ubuntu

''' 

 import sys ...


Last successful tokens:

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

  "

" at 44:23 consumed by file_input

  ")" at 44:22 consumed by file_input

  "response" at 44:14 consumed by file_input

  "(" at 44:13 consumed by file_input

  "_log_to_salt" at 44:1 consumed by file_input

  " " at 44:0 consumed by file_input

  " " at 44:0 consumed by file_input



Reply | Threaded
Open this post in threaded view
|

Re: Python issue

jbelbute
David
We solved the problem. It was a whitespace issue

Regards,
John
9493061477

On Apr 3, 2014, at 17:33, "David Racodon" <[hidden email]> wrote:

Hi John,

Would it be possible to provide the file (you can send it to me privately)?

Thank you

Regards,


David RACODON | SonarSource
Senior Consultant

---------------------------------------------
  Sign up to our newsletter here!
---------------------------------------------


On Wed, Apr 2, 2014 at 1:32 PM, Belbute, John <[hidden email]> wrote:
We are trying to parse some python files and are getting the following results.  We’ve looked at the file and the characters seem to be correct.  We’ve also run the file through pylint and have not seem the file.  Anyone have any ideas

Thanks
john

14:28:57.930 ERROR - Unable to parse source file : /home/jbelbute/ops/salt/_modules/nsutil.py

14:28:57.989 ERROR - Source Snippet:

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

   38             _log_to_salt(response)

   39 returnFalse

   40         except:

   41         response='Failed to load nsutil. '+

   42                  'Netscaler info is not in pillar data ! ' +

   43                  'Please fix it or maybe this is wrong host to run'

   44 _log_to_salt(response)

  -->         returnFalse

   46 

   47 def _get_netscaler_info():

   48     '''

   49     Return Netscaler IP, Username, Password that are stored in Pillar

   50 

   51     The function expects a dictionary like this from pillar data.

   52 

   53     {'netscaler': {'phx-intlb-3':{'ns_ip':'10.59.100.59',

   54                                   'ns_username': 'nitro',

   55                                   'ns_password': 'secret_password'

   56                                   }

   57                   }

   58     }

   59     '''

   60 return__pillar__['netscaler']

   61 

   62 def _get_hostname():

   63     '''

   64     Return hostname where this module is executed.

   65     '''

   66 returnsocket

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


on matcher or(NEWLINE, statement)

      45 :      0  : NEWLINE expected but "        " [INDENT] found

at file_input

       1 :      0  : '''

Salt Module: NetScaler State Change Utility


:maintainer: John Dong <[hidden email]>

:maturity: new

:depends: sys,json,urlib,socket,logging,httplib2,salt.utils.decorators

:platform: Ubuntu

''' 

 import sys ...


Last successful tokens:

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

  "

" at 44:23 consumed by file_input

  ")" at 44:22 consumed by file_input

  "response" at 44:14 consumed by file_input

  "(" at 44:13 consumed by file_input

  "_log_to_salt" at 44:1 consumed by file_input

  " " at 44:0 consumed by file_input

  " " at 44:0 consumed by file_input