~ after script filename?

P

presentt

Hello all,

I just wrote a really simple script and named it helloworld.py. Inside
was only:

#!/usr/bin/env
print "Hello, world"

I used chmod to set the permissions, and ran it to see what happened (I
just started learning Python, if you couldn't guess)

Then, I typed ls in the directory to see what was there, and I noticed
a new file, namely helloworld.py~ . What is that file (its contents
are identicle to helloworld.py)? Why the ~?

Thanks a lot. I'm using Ubuntu Linux 5.04 (Hoary), and wrote the
script with gedit.

~~Ted Present
 
A

Aldo Cortesi

Thus spake presentt ([email protected]):
Hello all,

I just wrote a really simple script and named it
helloworld.py. Inside was only:

#!/usr/bin/env print "Hello, world"

I used chmod to set the permissions, and ran it to see
what happened (I just started learning Python, if you
couldn't guess)

Then, I typed ls in the directory to see what was there,
and I noticed a new file, namely helloworld.py~ . What is
that file (its contents are identicle to helloworld.py)?
Why the ~?

Thanks a lot. I'm using Ubuntu Linux 5.04 (Hoary), and
wrote the script with gedit.

It doesn't have anything to do with Python. I'm pretty sure
you'll find that the file is created by your editor as a
backup or a running store of some kind. Try just editing a
random non-python file with the same editor, and see if you
find the same thing...


Cheers,


Aldo



--
Aldo Cortesi
(e-mail address removed)
http://www.nullcube.com
Off: (02) 9283 1131
Mob: 0419 492 863
 
P

presentt

Huh, no ~ on other files when I edit them, but at least I don't have to
worry about it. Thanks Aldo.
 
F

Fredrik Lundh

presentt said:
Huh, no ~ on other files when I edit them, but at least I don't have to
worry about it. Thanks Aldo.

according to

http://www.gnome.org/projects/gedit/

gedit supports backup files, so to figure out how and when they're
created, and how to control their creation, you probably just have
to read the documentation (which doesn't seem to exist on the web;
look in the "help" menu for the bundled version)

</F>
 
B

Benjamin Niemann

presentt said:
Hello all,

I just wrote a really simple script and named it helloworld.py. Inside
was only:

#!/usr/bin/env
print "Hello, world"

I used chmod to set the permissions, and ran it to see what happened (I
just started learning Python, if you couldn't guess)

Then, I typed ls in the directory to see what was there, and I noticed
a new file, namely helloworld.py~ . What is that file (its contents
are identicle to helloworld.py)? Why the ~?

Thanks a lot. I'm using Ubuntu Linux 5.04 (Hoary), and wrote the
script with gedit.

~~Ted Present

As others have already said: this is not a python issue.

A ~ suffix is commonly used by editors for backup file. If you save a file
from the editor, and the file already exists (so it doesn't happen the
first time you save a new file), the existing version is renamed with the ~
suffix.

After some time, you will learn to simply ignore these files ;)
Many file managers have already learnt this lesson and have options to hide
such backup files.
 
S

Steve Horsley

presentt said:
Hello all,

I just wrote a really simple script and named it helloworld.py. Inside
was only:

#!/usr/bin/env
print "Hello, world"

I used chmod to set the permissions, and ran it to see what happened (I
just started learning Python, if you couldn't guess)

Then, I typed ls in the directory to see what was there, and I noticed
a new file, namely helloworld.py~ . What is that file (its contents
are identicle to helloworld.py)? Why the ~?

Thanks a lot. I'm using Ubuntu Linux 5.04 (Hoary), and wrote the
script with gedit.

~~Ted Present

As others have said, this is a feature of gedit. It can make a
backup copy of the previous version as you save, and can also
automatically save periodically (default seems to be 10 minutes).
From the menus, choose:
Edit -> Preferences
and see the section marked File Saving.

Steve
 
P

presentt

Oh okay. Thank you all.

Now that you mention it, the ~ makes sense; I know M$ Word uses a ~ in
the temp files that it autosaves periodically. And I think I've seen
it with M$ Notepad too.

Thanks again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top