0

I'm not an expert in python please help me fix the error after installing python portabl 3.3.7 an error appeared in windows os error: there is no file in the directory but the file is in the directory python.exe

import os
import logging
import log_helper
import random
import uuid
import string
import random_utils

 logger = log_helper.setup_logger(name="system_fingerpring", 
 level=logging.INFO, 
 log_to_file=False)

import os.path

data_folder = os.path.join("C:\programs\PortablePython-3.3.7\App\Puthon", "267.txt")

file_to_open = os.path.join(data_folder, "267.txt")


with open('file276.txt') as file:
    self.install_date = file.readline()

the file is in the folder C:\programs\PortablePython-3.3.7\App\Puthon 267.txt in the file a date like 20.07.2020 which the variable should receive "self.install_date ="

thanks in advance

alex77
  • 1
  • 2
  • You should write \ as \\ when defining a path: https://stackoverflow.com/questions/2953834/windows-path-in-python – Łukasz Daniluk Jul 20 '20 at 14:05
  • Thank you, your link helped me figure out these paths – alex77 Jul 21 '20 at 02:23
  • also you put the name of the file twice. `data_folder = os.path.join("C:\programs\PortablePython-3.3.7\App\Puthon", "267.txt")` `file_to_open = os.path.join(data_folder, "267.txt")` – nadapez Oct 17 '21 at 07:39

0 Answers0