DOS, UNIX and tabs

B

Ben

Hi,

I have a python script on a unix system that runs fine. I have a python
script on a windows system that runs fine. Both use tabs to indent
sections of the code. I now want to run them on the same system,
actually in the same script by combining bits and pieces. But whatever
I try my windows tabs get converted to spaces when I transfer it to the
unix system and the interpreter complains that the indentation style is
not consistant throughout the file. Short of going through 350 lines of
code and manually replacing spaces with tabs what an I do? I'm thinking
there surely must be a simple solution I have missed here!

Cheers,

Ben
 
R

Roel Schroeven

Ben schreef:
I have a python script on a unix system that runs fine. I have a python
script on a windows system that runs fine. Both use tabs to indent
sections of the code. I now want to run them on the same system,
actually in the same script by combining bits and pieces. But whatever
I try my windows tabs get converted to spaces when I transfer it to the
unix system and the interpreter complains that the indentation style is
not consistant throughout the file. Short of going through 350 lines of
code and manually replacing spaces with tabs what an I do? I'm thinking
there surely must be a simple solution I have missed here!

How do you transfer the files or their contents from Windows to Unix and
vice versa? Whatever means you use shouldn't change the file contents,
except possibly conversion of line endings.

What editors do you use on both systems? Maybe it's just the way one of
your editors is configured? Are you sure there are tabs in the files, or
does one of your editors automatically convert them to spaces? Maybe
it's not a bad idea to view your Windows files with a Windows-based hex
editor to make sure the indentation is really made up of tabs.

BTW I'm a proponent of spaces instead of tabs, but indentation by tabs
only (i.e. not a mixture of tabs and spaces) is an acceptable solution
too and it should work.
 

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,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top