Menu

#37 UnboundLocalError: local variable 'url_' referenced before assignment

0.8.0
closed
None
5
2015-10-20
2015-03-06
No

Installation of tog-pegasus fails on openSUSE with

Additional rpm output:
MOF import failed! Check /var/lib/Pegasus/loadmof.log for details.
Traceback (most recent call last):
File "/usr/lib64/python2.7/site-packages/pywbem/mof_compiler.py", line 1765, in <module>
mofcomp.compile_file(fname, options.ns)

...
File "/usr/lib64/python2.7/site-packages/pywbem/cim_http.py", line 482, in wbem_request
s = os.stat(url_)

Discussion

  • Klaus Kämpf

    Klaus Kämpf - 2015-03-06

    Looking at cim_http.py around line 482 reveals:

        if url.startswith('http'):
            h = HTTPConnection(host,
                               port=port,
                               timeout=timeout)
        else:
            if url.startswith('file:'):
                url_ = url[5:]
            try:
                s = os.stat(url_)
    

    Looks like the "if url.startswith('file:'):" line is missing an "else:" statement ?

     
  • Klaus Kämpf

    Klaus Kämpf - 2015-03-06

    The offending command is

    /usr/sbin/pegutil /usr/lib64/python2.7/site-packages/pywbem/mof_compiler.py -n root/cimv2 -s /usr/share/mof/cim-current -u /var/run/tog-pegasus/cimxml.socket /usr/share/mof/cim-current/Interop/CIM_Namespace.mof

     
  • Klaus Kämpf

    Klaus Kämpf - 2015-03-06

    This seems to fix the error

    --- /usr/lib64/python2.7/site-packages/pywbem/cim_http.py~ 2015-03-06 10:53:53.489107675 +0100
    +++ /usr/lib64/python2.7/site-packages/pywbem/cim_http.py 2015-03-06 10:54:27.773181173 +0100
    @@ -479,6 +479,8 @@
    else:
    if url.startswith('file:'):
    url_ = url[5:]
    + else:
    + url_ = url
    try:
    s = os.stat(url_)
    if S_ISSOCK(s.st_mode):

     
  • Andreas Maier

    Andreas Maier - 2015-10-20
    • status: open --> closed
    • assigned_to: Andreas Maier
     
  • Andreas Maier

    Andreas Maier - 2015-10-20

    Fixed as proposed, in v0.8.0-dev.20151008 on the new project presence at GitHub: https://github.com/pywbem/pywbem

     
  • Andreas Maier

    Andreas Maier - 2015-10-20
    • Milestone: backlog --> 0.8.0