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

AI Thread Summary
In a Python 2.7 Jupyter notebook environment, users can encounter issues with multiple files sharing the same name, such as "Untitled 10," due to the way files are handled in memory versus on disk. The operating system, like Windows 7, prevents having two files with the same name in the same directory, but temporary files or in-memory copies can lead to confusion. Users may inadvertently open identical copies of a file and make different changes, resulting in potential data loss if the wrong version is saved. The recent files directory only shows shortcuts and does not preserve file contents if names collide. Properly managing file paths and understanding the file structure in the VM can help mitigate these issues.
WWGD
Science Advisor
Homework Helper
Messages
7,700
Reaction score
12,731
TL;DR Summary
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: 262
  • IMG_20191119_185344_01.jpg
    IMG_20191119_185344_01.jpg
    38.2 KB · Views: 258
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 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 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 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 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
Views
8K
Replies
9
Views
1K
Replies
3
Views
2K
Replies
6
Views
2K
Replies
0
Views
3K
Back
Top