Keyerror: ' USER ' ERROR

Source: Internet
Author: User

The third party module was imported manually and the error was invoked during the call, and the script was invoked as follows:

From Hivetask import hivetask

ht = Hivetask ()
#ht. Calendar.setmonth ( -12)
print ( Ht.calendar.getMonthFirst ()) print (Ht.calendar.getMonthLast ()) print (
ht.calendar.getYearWeek ())
The error message is as follows:

  File "d:/winpython/winpython-64bit-3.4.3.7/python-3.4.3.amd64/scripts/workspaces/20160329.py", line < module>
    ht = Hivetask ()

  File "C:\Python34\Lib\site-packages\jd_127environment\HiveTask.py", line, in __ init__
    self.username     = os.environ[' USER '

  File ' D:\winpython\WinPython-64bit-3.4.3.7\ python-3.4.3.amd64\lib\os.py ", line 633, in __getitem__
    raise Keyerror (key) from None

keyerror: ' USER '
Analysis Reason:

When Self.username is invoked in hivetask.py, the user variable throws an exception: Raise Keyerror (Key) from None.

Indicates that there is no user this environment variable in the window environment, but there is a username variable in the environment variable, just in line with the requirements of the Self.username, to replace:

Self.username     = os.environ[' username ']
Run again, problem solved
2016-03-30 08:33:00 Info Log location:/tmp/pgy_log//20160330
2016-03-30 08:33:00 info log location:/tmp/pgy_log//20160330
info:20160328: Log location:/tmp/pgy_log//20160330
2016-03-01
2016-03-31
14



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.