Мне действительно нужна помощь в докере.
мой файл докера выглядит так:
FROM python:3-alpine
LABEL author="alaa"
LABEL description="Dockerfile for Python script which generates emails"
RUN pip install tqdm
COPY email_generator.py /app/
CMD python3 /app/email_generator.py
мой код pthon выглядит так:
import json # to read json files
import os # to access operation for get and changing directory
def writeTextFile(text, index):
f = open(ziel + '/email_%s.txt' % index, 'w+')
f.write(text)
f.close()
def writeHashFile(text):
f = open(ziel + '/00_Hash.json', 'w+')
f.write(str(text))
f.close()
def readJsonCordinate(fileName):
"""Read the json data."""
with open(fileName, 'r', encoding='utf-8') as f: # Opening the file
data = json.load(f) # Read the json file
return data
и так далее. ..
мой вопрос: если я хочу получить файлы из хост-системы после создания образа, я получаю эту ошибку. но если я запускаю код нативно на pycharm в моей macOS, он отлично работает
Traceback (most recent call last):
File "/app/email_generator.py", line 112, in <module>
betreff = readJsonCordinate(quelle + '/Betreff.json')
File "/app/email_generator.py", line 22, in readJsonCordinate
with open(fileName, 'r', encoding='utf-8') as f: # Opening the file
FileNotFoundError: [Errno 2] No such file or directory: '/Users/soso/desktop/email_generator/Worterbuecher/Betreff.json'