1

I am kinda new to python programming so excuse me if i ask something for which the answer is obvious. I wanted to run a map reduce program so i install the mrjob package as needed. Now, when i try to run the sample program given:

from mrjob.job import MRJob

class MRWordFrequencyCount(MRJob):

def mapper(self, _, line):
    yield "chars", len(line)
    yield "words", len(line.split())
    yield "lines", 1

def reducer(self, key, values):
    yield key, sum(values)


if __name__ == '__main__':
    MRWordFrequencyCount.run()

I get an error saying Win error 5 permission denied and then printing the path where app data is stored. What am i doing wrong here?

amin saffar
  • 1,953
  • 3
  • 22
  • 34
Kyr
  • 31
  • 5

2 Answers2

0

You're forgetting the underscores

if __name__ == '__main__':
    MRWordFrequencyCount.run()
Ari K
  • 434
  • 2
  • 18
  • oh thank you for the quick answer, that was not the issue tho: No configs found; falling back on auto-configuration No configs specified for inline runner Running step 1 of 1... Creating temp directory C:\Users\kkiri\AppData\Local\Temp\mrpython.kkiri.20180312.161319.365500 Streaming final output from C:\Users\kkiri\AppData\Local\Temp\mrpython.kkiri.20180312.161319.365500\output... – Kyr Mar 12 '18 at 16:14
  • the error is huge so the last line of it is this one-->PermissionError: [WinError 5] Access is denied: 'C:\\Users\\kkiri\\AppData\\Local\\Temp\\mrpython.kkiri.20180312.161319.365500\\step\\000\\cache\\mrpython.py' – Kyr Mar 12 '18 at 16:15
  • Since it's a permission error try running the code with sudo. Relevant: https://stackoverflow.com/questions/26091530/permissionerror-winerror-5-access-is-denied-python-using-moviepy-to-write-gif – Ari K Mar 12 '18 at 16:17
  • I have already tried running the script as admin but it won't work sadly. – Kyr Mar 12 '18 at 16:22
0

My resolution via this Github ticket I submitted to Yelp/MrJob:

Issue

Running MRJob 0.6.3 in a python 3.6.x installation will produce the following error (similar to my local Windows machine):

Removing temp directory C:\temp\app.{UserName}.20180707.222938.021378... [WinError 5] Access is denied: 'C:\\temp\\app.{UserName}.20180707.222938.021378\\step\\000\\cache\\app.py' Traceback (most recent call last): ... PermissionError: [WinError 5] Access is denied: 'C:\\temp\\app.{UserName}.20180707.222938.021378\\step\\000\\cache\\app.py'

Attempts 1. Tried running CLI as administrator 2. Tried changing temporary folder TEMP 3. pip uninstall mrjob and then did pip install mrjob==0.5.10

Resolution The 3rd attempt worked. By going through and installing the MRJob version 0.5.10, latest in documentation here, I got my application to work.