Skip to content
This repository was archived by the owner on Apr 12, 2018. It is now read-only.
This repository was archived by the owner on Apr 12, 2018. It is now read-only.

os.environ['HOME'] on Windows throws error #41

Open

Description

@BenjaminDavison

Hi,

Using os.environ['HOME'] is invalid for Windows, Windows does not have a HOME env variable.

Traceback (most recent call last):
  File "C:\Users\Ben\AppData\Local\Aptana Studio 3\plugins\org.python.pydev_2.7.0.2013032300\pysrc\pydevd.py", line 1397, in <module>
    debugger.run(setup['file'], None, None)
  File "C:\Users\Ben\AppData\Local\Aptana Studio 3\plugins\org.python.pydev_2.7.0.2013032300\pysrc\pydevd.py", line 1090, in run
    pydev_imports.execfile(file, globals, locals) #execute the script
  File "C:\Users\Ben\Documents\Aptana Studio 3 Workspace\swf_test\new_file.py", line 2, in <module>
    from swf.models.domain import Domain, DomainDoesNotExist
  File "C:\Python27\lib\site-packages\swf\models\__init__.py", line 8, in <module>
    from swf.models.base import BaseModel
  File "C:\Python27\lib\site-packages\swf\models\base.py", line 10, in <module>
    from swf.core import ConnectedSWFObject
  File "C:\Python27\lib\site-packages\swf\core.py", line 13, in <module>
    SETTINGS = settings.get()
  File "C:\Python27\lib\site-packages\swf\settings.py", line 125, in get
    home_directory = os.environ['HOME']
  File "C:\Python27\lib\os.py", line 423, in __getitem__
    return self.data[key.upper()]
KeyError: 'HOME'

This stackoverflow question: http://stackoverflow.com/questions/14742064/python-os-environhome-works-on-idle-but-not-in-a-script has a suggestion on how to solve the problem (fyi I tried os.path.expanduser('~') and that worked, but I don't have any other OS's to test with at the moment)

Thanks,

Ben

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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