Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python 3.6.5 - Saving files
#1
Hello, today I upgrade to 3.6.5 and notice something very different right off the bat. I been using 2.7, 3.5 and never had this issue before - but when I save/read files, open(), the file longer is created in root of where I start the command. Aka, if I create a bat file to start the program - it usually made that the root and started from there in terms of reading or editing files. Instead, it seems like it is not saving in the same place and saving some place else I can not find. It seems python made some more changes under the hood that I don't seem to like if this is the case:) but I need to know where it is saving any files at. Is there a way to see the full path a file is being created/saved at?

os.getcwd() shows the current path seems like something in 3.6.5 is off here.
Reply
#2
show code, it's really not possible to answer correctly without, but I'm guessing you want to assure that the data file is in the same directory as the program that creates it. You can assure this by adding the following code at the start of your program:
import os

# add the following to your first run function, class or method
os.chdir(os.path.dirname(__file__))
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Saving progress in a Python program to use later Led_Zeppelin 9 2,184 Sep-11-2022, 01:32 PM
Last Post: snippsat
  saving and loading text from the clipboard with python program MaartenRo 2 1,666 Jan-22-2022, 05:04 AM
Last Post: MaartenRo
  Showing and saving the output of a python file run through bash Rim 3 2,478 Oct-06-2021, 10:48 AM
Last Post: gerpark
  saving only one line of a figure as an image (python matplotlib) nitrochloric 0 2,032 Nov-23-2020, 01:41 PM
Last Post: nitrochloric
  extract zip from .msg files and saving according to date stamp of email natjo 3 2,952 Aug-13-2020, 09:35 PM
Last Post: bowlofred
  Saving Files Kristenl2784 3 2,028 Jul-13-2020, 04:36 PM
Last Post: bowlofred
  Downloading And Saving Zip Files To A Particular Path Folder eddywinch82 2 2,574 Jan-06-2020, 07:56 PM
Last Post: eddywinch82
  New to Python, help with saving image from camera tantony 2 3,868 Sep-13-2019, 05:19 PM
Last Post: tantony
  Saving python cmd output into a text file with colours kapilan15 2 7,079 Jan-25-2019, 06:25 PM
Last Post: metulburr
  Running a python tool transforming xml files into epub files silfer 7 5,442 May-10-2018, 03:49 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020