IOError: [Errno 2] No such file or directory when run in Flex App Engine

IOError: [Errno 2] No such file or directory when run in Flex App Engine



I try to run dataflow pipeline which use a python files that integrated with pickle file below:



dataflow.py


from stopwords import StopWords
stopwords = StopWords()
...
data = (pipeline | 'read' >> ReadFromText (gs://some/inputData.txt)
| 'stopwords' >> beam.Map(lambda x:'id':x['id'],'text': stopwords.validate(x['text'])))



stopwords.py


class StopWords:
def __init__ (self):

module_dir = os.path.dirname(__file__)
self.words = pickle.load(open(os.path.join(module_dir, 'model/sw.p'), "rb"))



How ever, I found an error:



IOError: [Errno 2] No such file or directory:
'/usr/local/lib/python2.7/dist-packages/dataflow/model/sw.p'



I try to debug self.words and it run smoothly. however, it countered a problem when I run it in google cloud dataflow job.


self.words



Anyone can help?




1 Answer
1



Your StopWords class is attempting to load the model (sw.p) from the same directory as the stopwords.py file, but it seems like the models hasn't gotten deployed along with your code.


StopWords


sw.p


stopwords.py



Perhaps try putting the sw.p file you have locally into a Google Cloud Storage bucket and loading it from there instead?


sw.p



Thanks for contributing an answer to Stack Overflow!



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)