Skip to content

Windows : ImportError: No module named pwd on util.py#356

@firm1

Description

@firm1

When i try to build gitpython on Windows Server i have this error message.

File "C:\project\.tox\back\lib\site-packages\git\objects\commit.py", line 318,in create_from_tree committer = committer or Actor.committer(cr) File "C:\project\.tox\back\lib\site-packages\git\util.py", line 416,in committer return cls._main_actor(cls.env_committer_name, cls.env_committer_email, config_reader) File "C:\project\.tox\back\lib\site-packages\git\util.py", line 386,in _main_actor default_email = get_user_id() File "C:\project\.tox\back\lib\site-packages\git\util.py", line 152,in get_user_id return"%s@%s"% (getpass.getuser(), platform.node()) File "c:\python27\Lib\getpass.py", line 157,in getuser import pwd ImportError: No module named pwd

After search, the only solution is try this hack on utiy.py file.

Then use this :

try: importpwdexceptImportError: importwinpwdaspwdimportosdefget_user_id(): """:return: string identifying the currently active system user as name@node"""return"%s@%s"% (pwd.getpwuid(os.getuid()).pw_name, platform.node())

instead of

importgetpassdefget_user_id(): """:return: string identifying the currently active system user as name@node"""return"%s@%s"% (getpass.getuser(), platform.node())

What do you think about that ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions