Same file name, Different Files (Different Content) Python 2.7 Jupyt

  • Context: Python 
  • Thread starter Thread starter WWGD
  • Start date Start date
  • Tags Tags
    File files Python
Click For Summary

Discussion Overview

The discussion revolves around the issue of having two files named "Untitled 10" in a Jupyter notebook environment while using Python 2.7. Participants explore the implications of file naming conventions, file system behaviors, and potential causes for the observed phenomenon of differing content in files with identical names.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant notes the presence of two files named "Untitled 10" in their Jupyter notebook and questions how this is possible given typical file system restrictions.
  • Another participant suggests that some file systems, like Linux, allow for case-sensitive filenames, while others, like macOS, may not allow overwriting files with the same name.
  • There is speculation about whether the files are actually two distinct files in the operating system or if they are just separate instances in memory with different changes made to each.
  • A participant reflects on past experiences of saving the wrong file and acknowledges the potential for confusion in managing multiple copies of the same file.
  • Further discussion indicates that the actual file on disk may be singular, with the two instances being either in-memory copies or temporary files, depending on the auto-save behavior of Jupyter.
  • Participants clarify that the Windows operating system does not allow two files with the same name in the same directory, which applies to both the client and host systems in a virtual machine setup.
  • One participant expresses concern about locating the files in the 'recent' directory, noting that it only contains shortcuts and does not preserve file contents.
  • Another participant raises a separate issue regarding the requirement to provide a path when saving notebooks in Anaconda Python 2.7, indicating uncertainty about appropriate path choices.

Areas of Agreement / Disagreement

Participants express various viewpoints on the nature of file handling in the context of Jupyter notebooks and operating systems, with no clear consensus reached on the underlying cause of the issue or the best practices for managing files with identical names.

Contextual Notes

Participants mention the potential for confusion due to the handling of files in memory versus on disk, as well as the implications of different operating systems and file systems on file naming conventions.

Who May Find This Useful

This discussion may be of interest to users of Jupyter notebooks, particularly those working with Python 2.7 in virtual machine environments, as well as individuals encountering file management issues in different operating systems.

WWGD
Science Advisor
Homework Helper
Messages
7,806
Reaction score
13,120
TL;DR
Same file name for files with different content in VMWare. ????
So I have Python 2.7 ( Don't ask) installed in my VM.

Now I have two files named " Untitled 10" in my Jupyter notebook therein ( Notice the bottom cell in both files , named "Untitled 10" -- please see top of attachments -- which have different content in the "bottom-most" cell ); please see first two attachments. How can this happen? Doesn't the VM OS or something else prevent using the same name for different files?
 

Attachments

  • IMG_20191119_185344_02.jpg
    IMG_20191119_185344_02.jpg
    45.9 KB · Views: 281
  • IMG_20191119_185344_01.jpg
    IMG_20191119_185344_01.jpg
    38.2 KB · Views: 280
Technology news on Phys.org
Some file systems allow for upper and lower case filenames like linux whereas others like macos preserve the casing but balk when you try to save one over the other.

In your case do you see two files in the os environment with the same name? Or will it overwrite the contents depending on which part of your session you decide to change.

Another possibility is the file is a kind of database saving the blocks at different locs in the file.
 
  • Like
Likes   Reactions: WWGD
jedishrfu said:
Some file systems allow for upper and lower case filenames like linux whereas others like macos preserve the casing but balk when you try to save one over the other.

In your case do you see two files in the os environment with the same name? Or will it overwrite the contents depending on which part of your session you decide to change.

Another possibility is the file is a kind of database saving the blocks at different locs in the file.
Ah, I am thinking I opened up two identical copies, had them both open but made different changes to each. I need to 2-check where the Python VM files are saved to see the file structure.
 
  • Like
Likes   Reactions: jedishrfu
Yeah, I've done that disaster "waiting to happen" where you save the wrong copy to file.
 
WWGD said:
I am thinking I opened up two identical copies, had them both open but made different changes to each.
In that case you will have only one file on disk at /notebooks/Downloads/Untitled 10.ipynb. The two "copies" are either just in memory separately or are copies/diffs in temporary files. The Untitled 10.ipynb file will have the contents of the last auto-saved tab (unless auto-save goes to the temporary files).

The structure of all of this is based on the server you have running at localhost:8888 and any code embedded in the served pages.

WWGD said:
Doesn't the VM OS or something else prevent using the same name for different files?

Yes. The client OS is Windows 7 and you can't have two of the same file. This also applies to the host Windows 10 which is the same file system.

VMWare just deals in virtual hard drives so it imposes no restriction on the structure of the client file system.

BoB
 
  • Like
Likes   Reactions: WWGD
rbelli1 said:
In that case you will have only one file on disk at /notebooks/Downloads/Untitled 10.ipynb. The two "copies" are either just in memory separately or are copies/diffs in temporary files. The Untitled 10.ipynb file will have the contents of the last auto-saved tab (unless auto-save goes to the temporary files).

The structure of all of this is based on the server you have running at localhost:8888 and any code embedded in the served pages.
Yes. The client OS is Windows 7 and you can't have two of the same file. This also applies to the host Windows 10 which is the same file system.

VMWare just deals in virtual hard drives so it imposes no restriction on the structure of the client file system.

BoB
Thanks. I ( meaning win7) have a directory 'recent' for recently used files. Hope they will both be there -- or anywhere else. I will look for them by time stamp.
 
WWGD said:
I ( meaning win7) have a directory 'recent' for recently used files.

That folder is just a bunch of shortcuts. If you have two files with the same name but different folder then the less recently opened one will get replaced in the recent files list. In any case it will not preserve any file contents.

BoB
 
  • Like
Likes   Reactions: WWGD
Thanks again. One issue I was having is that in order to save the notebook in Anaconda Python 2.7 , I must provide a path for it and was not sure on what the path should be other than some obvious choices.
 

Similar threads

  • · Replies 12 ·
Replies
12
Views
9K
  • · Replies 17 ·
Replies
17
Views
3K
Replies
6
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 0 ·
Replies
0
Views
3K