I have been trying a program in python for mapreduce and need some help in it : To get more hands-on experience I wanted to try a project word count. Here is the sample data which I have. 

    

> The United Nations (UN) is an intergovernmental organisation
> established on 24 October 1945 to promote international cooperation. A
> replacement for the ineffective League of Nations, the organisation
> was created following World War II to prevent another such conflict.
> At its founding, the UN had 51 member states; there are now 193. The
> UN Headquarters resides in international territory in New York City,
> with further main offices in Geneva, Nairobi, and Vienna. The
> organisation is financed by assessed and voluntary contributions from
> its member states. Its objectives include maintaining international
> peace and security, promoting human rights, fostering social and
> economic development, protecting the environment, and providing
> humanitarian aid in cases of famine, natural disaster, and armed
> conflict.
>     
> During World War II, US President Franklin D. Roosevelt initiated talks on a successor agency to the League of Nations, and the United
> Nations Charter was drafted at a conference in AprilJune 1945; this
> charter took effect on 24 October 1945, and the UN began operation.
> The UN's mission to preserve world peace was complicated in its early
> decades by the Cold War between the US and USSR and their respective
> allies, though the organization participated in major actions in Korea
> and the Congo, as well as approving the creation of the state Israel
> in 1947. The organisation's membership grew significantly following
> widespread decolonization in the 1960s, and by the 1970s, its budget
> for economic and social development programmes far outstripped its
> spending on peacekeeping. After the end of the Cold War, the UN took
> on major military and peacekeeping missions in Kuwait, Namibia,
> Cambodia, Bosnia, Rwanda, Somalia, Sudan, and the Democratic Republic
> of Congo with varying degrees of success.
>     The UN has six principal organs: the General Assembly (the main deliberative assembly); the Security Council (for deciding certain
> resolutions for peace and security); the Economic and Social Council
> (ECOSOC) (for promoting international economic and social co-operation
> and development); the Secretariat (for providing studies, information,
> and facilities needed by the UN); the International Court of Justice
> (the primary judicial organ); and the United Nations Trusteeship
> Council (inactive since 1994). UN System agencies include the World
> Bank Group, the World Health Organization, the World Food Programme,
> UNESCO, and UNICEF. The UN's most prominent officer is the
> Secretary-General, an office held by Ban Ki-moon of South Korea since
> 2007. Non-governmental organisations may be granted consultative status with ECOSOC and other agencies to participate in the UN's work.The organisation won the 2001 Nobel Peace Prize, and a number of its officers and agencies have also been awarded the prize. Other evaluations of the UN's effectiveness have been mixed. Some commentators believe the organisation to be an important force for peace and human development, while others have called the organisation ineffective, corrupt, or biased.

and i used the following python code to get my result

    from mrjob.job import MRJob
    
    from mrjob.step import MRStep
    
    
    
    class MovieRatings(MRJob):
    
        def steps(self):
    
            return [
    
                MRStep(mapper=self.mapper_get_ratings,
    
                       reducer=self.reducer_count_ratings),
    
      ]
    
    
    
        def mapper_get_ratings(self, _, line):
    
            (word) = line.split(' ')
    
            yield word, 1
    
    
    
        def reducer_count_ratings(self, key, values):
    
            yield Key, sum(values)
    
    
    if __name__ == '__main__':
    
        MovieRatings.run()

 i am getting the following error

    [root@localhost Desktop]# python RatingsBreakdown.py UN.txt
    Traceback (most recent call last):
      File "RatingsBreakdown.py", line 1, in <module>
        from mrjob.job import MRJob
      File "/usr/lib/python2.6/site-packages/mrjob/job.py", line 1106
        for k, v in unfiltered_jobconf.items() if v is not None
          ^
    SyntaxError: invalid syntax
    [root@localhost Desktop]# python3 RatingsBreakdown.py UN.txt
    No configs found; falling back on auto-configuration
    No configs specified for inline runner
    Running step 1 of 2...
    Creating temp directory /tmp/RatingsBreakdown.training.20171128.083536.602598
    Error while reading from /tmp/RatingsBreakdown.training.20171128.083536.602598/step/000/mapper/00000/input:
    Traceback (most recent call last):
      File "RatingsBreakdown.py", line 25, in <module>
        RatingsBreakdown.run()
      File "/usr/lib/python3.4/site-packages/mrjob/job.py", line 424, in run
        mr_job.execute()
      File "/usr/lib/python3.4/site-packages/mrjob/job.py", line 445, in execute
        super(MRJob, self).execute()
      File "/usr/lib/python3.4/site-packages/mrjob/launch.py", line 185, in execute
        self.run_job()
      File "/usr/lib/python3.4/site-packages/mrjob/launch.py", line 233, in run_job
        runner.run()
      File "/usr/lib/python3.4/site-packages/mrjob/runner.py", line 511, in run
        self._run()
      File "/usr/lib/python3.4/site-packages/mrjob/sim.py", line 144, in _run
        self._run_mappers_and_combiners(step_num, map_splits)
      File "/usr/lib/python3.4/site-packages/mrjob/sim.py", line 185, in _run_mappers_and_combiners
        for task_num, map_split in enumerate(map_splits)
      File "/usr/lib/python3.4/site-packages/mrjob/sim.py", line 120, in _run_multiple
        func()
      File "/usr/lib/python3.4/site-packages/mrjob/sim.py", line 662, in _run_mapper_and_combiner
        run_mapper()
      File "/usr/lib/python3.4/site-packages/mrjob/sim.py", line 685, in _run_task
        stdin, stdout, stderr, wd, env)
      File "/usr/lib/python3.4/site-packages/mrjob/inline.py", line 92, in invoke_task
        task.execute()
      File "/usr/lib/python3.4/site-packages/mrjob/job.py", line 433, in execute
        self.run_mapper(self.options.step_num)
      File "/usr/lib/python3.4/site-packages/mrjob/job.py", line 517, in run_mapper
        for out_key, out_value in mapper(key, value) or ():
      File "RatingsBreakdown.py", line 13, in mapper_get_ratings
        (userID, movieID, rating, timestamp) = line.split('\t')
    ValueError: need more than 1 value to unpack
    [root@localhost Desktop]# python3 MovieRatings.py UN.txt
    No configs found; falling back on auto-configuration
    No configs specified for inline runner
    Running step 1 of 1...
    Creating temp directory /tmp/MovieRatings.training.20171128.083635.368889
    Error while reading from /tmp/MovieRatings.training.20171128.083635.368889/step/000/reducer/00000/input:
    Traceback (most recent call last):
      File "MovieRatings.py", line 20, in <module>
        MovieRatings.run()
      File "/usr/lib/python3.4/site-packages/mrjob/job.py", line 424, in run
        mr_job.execute()
      File "/usr/lib/python3.4/site-packages/mrjob/job.py", line 445, in execute
        super(MRJob, self).execute()
      File "/usr/lib/python3.4/site-packages/mrjob/launch.py", line 185, in execute
        self.run_job()
      File "/usr/lib/python3.4/site-packages/mrjob/launch.py", line 233, in run_job
        runner.run()
      File "/usr/lib/python3.4/site-packages/mrjob/runner.py", line 511, in run
        self._run()
      File "/usr/lib/python3.4/site-packages/mrjob/sim.py", line 150, in _run
        self._run_reducers(step_num, num_reducer_tasks)
      File "/usr/lib/python3.4/site-packages/mrjob/sim.py", line 246, in _run_reducers
        for task_num in range(num_reducer_tasks)
      File "/usr/lib/python3.4/site-packages/mrjob/sim.py", line 120, in _run_multiple
        func()
      File "/usr/lib/python3.4/site-packages/mrjob/sim.py", line 685, in _run_task
        stdin, stdout, stderr, wd, env)
      File "/usr/lib/python3.4/site-packages/mrjob/inline.py", line 92, in invoke_task
        task.execute()
      File "/usr/lib/python3.4/site-packages/mrjob/job.py", line 439, in execute
        self.run_reducer(self.options.step_num)
      File "/usr/lib/python3.4/site-packages/mrjob/job.py", line 560, in run_reducer
        for out_key, out_value in reducer(key, values) or ():
      File "MovieRatings.py", line 17, in reducer_count_ratings
        yield Key, sum(values)
    NameError: name 'Key' is not defined

Would like to solve the error and understand what mistake i have done.

Thanks