Need help with eco2pgn.py

Discussion of anything and everything relating to chess playing software and machines.

Moderator: Ras

Adam Hair
Posts: 3226
Joined: Wed May 06, 2009 10:31 pm
Location: Fuquay-Varina, North Carolina

Re: Need help with eco2pgn.py

Post by Adam Hair »

alpha123 wrote:
Adam Hair wrote:Thanks Peter. At the very least it gives me an example to go by if I start trying to learn Python.
You should definitely learn Python. It's a wonderful language, IMO.

Peter
It would certainly make some tasks easier for me in some of the things
I am trying to do. I just need to make time to read and then play
around with it.

Adam
Ron Murawski
Posts: 397
Joined: Sun Oct 29, 2006 4:38 am
Location: Schenectady, NY

Re: Need help with eco2pgn.py

Post by Ron Murawski »

Adam Hair wrote:
Ron Murawski wrote:
Adam Hair wrote:
Ron wrote:Why not redirect standard output?

At a Windows command prompt, this is done like this:
Code:
program -param1 -param2 >>filename.extension


Ron
Funny enough, I could not do it the way Ron said to do it ( :?: ), but
I made the following batch file and it worked:

Code: Select all

eco2pgn.py scid.eco >>eco.pgn
Thanks Neil and Ron

Adam
I was trying to show you the general case. In your specific case: the 'program' was:
eco2pgn.py
there was only one parameter, '-param1', needed:
scid.eco
and your redirected file was:
eco.pgn

I didn't bother with that stuff because I thought you needed to know about the redirect characters:
>>

It's impossible to guess other people's expertise. You were bright enough to guess what I meant, though! :-)

Ron
I also could not make c:\filepath\eco2pgn.py scid.eco >>eco.pgn work,
by which I mean redirect to eco.pgn. I have had trouble a few other
times in the past running programs from the command line. There must
be something I am not doing right. However, every time I have had
trouble with the command line, I have been able to write a batch file
as a work around.

As far as my expertise goes, it is miniscule. Most of what I have learned
has been from mimicking what I have seen in other people's batch files
and instructions and then figuring out what I did wrong when something
does not run properly. I was really happy when you said to redirect the
output. I sort of knew what was going on, but I lacked the proper term
( redirect ) to find the info I needed on Google.

Thanks again Ron.

Adam
Hi Adam,

I think that your commandline worked perfectly but you were unable to find the
resulting file. The file will wind up in your current working directory, not in
the 'c:\filepath\' directory. In order to get it to work as you expect you need
to fully specify your paths:
c:\filepath\eco2pgn.py scid.eco >>c:\filepath\eco.pgn
This will work no matter which directory you run the program from. Alternately,
you can change directory into the eco2pgn.py directory and then it will become
the cwd (current working directory) and your original syntax will work.

I suspect that you put your batch file into the same directory as the python
program, so the output file was exactly where you expected it to be. Try
searching your drive for eco.pgn. You will probably find it in:
C:\Documents and Settings\<username>

I'm happy to help you out. There's not as much information these days about
commandline syntax as there was back in the days of DOS.

Ron
User avatar
michiguel
Posts: 6401
Joined: Thu Mar 09, 2006 8:30 pm
Location: Chicago, Illinois, USA

Re: Need help with eco2pgn.py

Post by michiguel »

SzG wrote:
Ron Murawski wrote: I didn't bother with that stuff because I thought you needed to know about the redirect characters:
>>
I had thought the redirect character was a single >, I have used it several times to direct engine output to a file.
Both. The difference is that > will redirect it into a new file (if there was another one with the same name it will be erased) and >> will append the information to the old file, if there was one.

Miguel
Adam Hair
Posts: 3226
Joined: Wed May 06, 2009 10:31 pm
Location: Fuquay-Varina, North Carolina

Re: Need help with eco2pgn.py

Post by Adam Hair »

Ron Murawski wrote:
Adam Hair wrote:
Ron Murawski wrote:
Adam Hair wrote:
Ron wrote:Why not redirect standard output?

At a Windows command prompt, this is done like this:
Code:
program -param1 -param2 >>filename.extension


Ron
Funny enough, I could not do it the way Ron said to do it ( :?: ), but
I made the following batch file and it worked:

Code: Select all

eco2pgn.py scid.eco >>eco.pgn
Thanks Neil and Ron

Adam
I was trying to show you the general case. In your specific case: the 'program' was:
eco2pgn.py
there was only one parameter, '-param1', needed:
scid.eco
and your redirected file was:
eco.pgn

I didn't bother with that stuff because I thought you needed to know about the redirect characters:
>>

It's impossible to guess other people's expertise. You were bright enough to guess what I meant, though! :-)

Ron
I also could not make c:\filepath\eco2pgn.py scid.eco >>eco.pgn work,
by which I mean redirect to eco.pgn. I have had trouble a few other
times in the past running programs from the command line. There must
be something I am not doing right. However, every time I have had
trouble with the command line, I have been able to write a batch file
as a work around.

As far as my expertise goes, it is miniscule. Most of what I have learned
has been from mimicking what I have seen in other people's batch files
and instructions and then figuring out what I did wrong when something
does not run properly. I was really happy when you said to redirect the
output. I sort of knew what was going on, but I lacked the proper term
( redirect ) to find the info I needed on Google.

Thanks again Ron.

Adam
Hi Adam,

I think that your commandline worked perfectly but you were unable to find the
resulting file. The file will wind up in your current working directory, not in
the 'c:\filepath\' directory. In order to get it to work as you expect you need
to fully specify your paths:
c:\filepath\eco2pgn.py scid.eco >>c:\filepath\eco.pgn
This will work no matter which directory you run the program from. Alternately,
you can change directory into the eco2pgn.py directory and then it will become
the cwd (current working directory) and your original syntax will work.

I suspect that you put your batch file into the same directory as the python
program, so the output file was exactly where you expected it to be. Try
searching your drive for eco.pgn. You will probably find it in:
C:\Documents and Settings\<username>

I'm happy to help you out. There's not as much information these days about
commandline syntax as there was back in the days of DOS.

Ron
Yes, I put my batch file in the same directory as eco2pgn.py because
I knew that the file would be outputted there.

I didn't find eco.pgn in Documents and Settings, but I did find some
other missing files :lol: . Thanks for the tip Ron.