AttributeError: 'module' object has no attribute 'letters'

Discussion in 'Python' started by black_13, Feb 11, 2008.

  1. black_13

    black_13 Guest

    what does this error mean?
    i am trying to use mark hammonds win32 package.

    Traceback (most recent call last):
    File "", line 11, in <module>
    import win32com.client
    File "C:\Python25\lib\site-packages\win32com\client\",
    line 12, in <module>
    import dynamic, gencache, pythoncom
    File "C:\Python25\Lib\site-packages\win32com\client\",
    line 24, in <module>
    import build
    File "C:\Python25\lib\site-packages\win32com\client\", line
    507, in <module>
    valid_identifier_chars = string.letters + string.digits + "_"
    AttributeError: 'module' object has no attribute 'letters'

    black_13, Feb 11, 2008
    1. Advertisements

  2. black_13

    Ben Finney Guest

    It means that you're trying to access the attribute 'letters' on a
    module that doesn't have that attribute.

    You need to find what the value of 'string' is at that point in the
    code. If I had to guess, I would say the person who wrote the above
    line was expecting 'string' to be bound to the Python standard library
    module 'string'; but that the code you have binds that name to some
    other module.
    Ben Finney, Feb 11, 2008
    1. Advertisements

  3. black_13

    John Machin Guest

    If you have a file called in the same directory as your
    script, move/rename/delete it.
    Otherwise run python from the command line with the -v option and find
    where it's getting the interloper string module from.
    John Machin, Feb 11, 2008
  4. interloper: my new word of the day. Thanks!

    PS: Another way would be to run the script with python -i, and when it
    halts, execute:

    import string
    print string.__file__
    Gabriel Genellina, Feb 12, 2008
  5. black_13

    black_13 Guest

    You were correct! I went back to my work machine and there it was. For
    insane reason I had a py file in the same directory as the
    I was working on.
    black_13, Feb 12, 2008
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.