WMI - invalid syntax error?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • py

    #1

    WMI - invalid syntax error?

    Hi,
    I am running python 2.4.2 on win xp pro. I have the WMI module from
    Tim Golden (http://tgolden.sc.sabren.com/python/wmi.html).

    I have some code which does this...

    MyScript.py
    ------------------
    import wmi
    # the ip of my own local desktop
    machine = "1.2.3.4"
    try:
    w = wmi.WMI(machine ) # also tried, wmi.WMI(compute r=machine)
    except Exception, e:
    print "ERROR:", e

    c:>python[color=blue][color=green]
    >> from MyScript import *[color=darkred]
    >>> ERROR: -0x7ffbfe1c - Invalid syntax[/color][/color][/color]
    [color=blue][color=green]
    >> import wmi
    >> w = wmi.WMI("1.2.3. 4")
    >>[/color][/color]

    .....So when I import the script I get the "invalid syntax" error (which
    comes from the line, w = wmi.WMI(....))

    but in the same window if I just type it in manually I get no error.

    Any ideas???

  • py

    #2
    Re: WMI - invalid syntax error?

    here's the trace...

    File "MyScript.p y", line 10,
    wmiObj = wmi.WMI(machine )
    File "wmi.py", line 519, in __init__
    handle_com_erro r (error_info)
    File "wmi.py", line 131, in handle_com_erro r
    raise x_wmi, "\n".join (exception_stri ng)
    x_wmi: -0x7ffbfe1c - Invalid syntax

    Comment

    • py

      #3
      Re: WMI - invalid syntax error?

      one more note, I am using WMI v0.6 ....however, I also tried it with
      the latest version 1.0 rc2.

      Comment

      Working...