Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 306 has an indentation issue in gencache.py which causes an error #2161

Closed
AndyCWB opened this issue Dec 18, 2023 · 1 comment · Fixed by #2167
Closed

Version 306 has an indentation issue in gencache.py which causes an error #2161

AndyCWB opened this issue Dec 18, 2023 · 1 comment · Fixed by #2167

Comments

@AndyCWB
Copy link

AndyCWB commented Dec 18, 2023

  • Expected behavior and actual behavior.
    Expected: import of win32 modules does not produce an error.
    Actual (edited to remove proprietary path information:
Error: inconsistent use of tabs and spaces in indentation (gencache.py, line 64)  File "<string>", line 101, in <module>
      File ".........python38\\lib\\site-packages\\xxxxx\\os_help\\win_help.py\", line 22, in <module>
        import win32com.client
      File ".........python38\\lib\\site-packages\\win32com\\client\\__init__.py\", line 14, in <module>
        from . import dynamic, gencache
  • Steps to reproduce the problem.
    import win32com.client

  • Version of Python and pywin32
    Python 3.8.18 and pywin32 v306

  • Fix: convert all indentation to spaces in the usage() function - lines 771-776 in gencache.py

@Avasam
Copy link
Collaborator

Avasam commented Jan 12, 2024

Something doesn't seem to add up. The exception mentions gencache.py:64, not gencache.py:771-776. Line 64 doesn't have mixed indentation. It also seems like usage method could only be called from executing the module anyway, not importing it. Tabs in strings is fine anyway.

I was not able to replicate, even with this simplified scenario:

import sys
print(sys.version)
print(sys.platform)

def usage():
    usageString = """\
	  Usage: gencache [-q] [-d] [-r]

			 -q         - Quiet
			 -d         - Dump the cache (typelibrary description and filename).
			 -r         - Rebuild the cache dictionary from the existing .py files
	"""
    print(usageString)
      
usage()
3.8.5 (default, Jul 20 2020, 23:11:29) 
[GCC 9.3.0]
linux
	  Usage: gencache [-q] [-d] [-r]

			 -q         - Quiet
			 -d         - Dump the cache (typelibrary description and filename).
			 -r         - Rebuild the cache dictionary from the existing .py files
	

I still think it would be better to not mix indent in strings out of principle and consistency (and this isn't caught by black because it's in a string obviously). So I opened #2167

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants