convert-ly from the commandline under windows corrupted?

classic Classic list List threaded Threaded
23 messages Options
12
Reply | Threaded
Open this post in threaded view
|

convert-ly from the commandline under windows corrupted?

Eluze
following the instructions in AU:

"Alternatively, if you want to specify a different name for the upgraded file, preserving the original file and name unchanged, use

convert-ly myfile.ly > mynewfile.ly
"

I get (under windows 7)


close failed: [Errno 9] Bad file descriptor

with an older version there is:

convert-ly.py (GNU LilyPond) 2.14.2
Processing `myfile.ly'...
Applying conversion: convert-ly.py: error: : Unable to open file
convert-ly.py: error: : Unable to open file
convert-ly.py: error: : Unable to open file
convert-ly.py: error: : Unable to open file
convert-ly.py: error: : Unable to open file
convert-ly.py: error: : Unable to open file
convert-ly.py: error: : Unable to open file

anything known about that?

Eluze
Reply | Threaded
Open this post in threaded view
|

Re: convert-ly from the commandline under windows corrupted?

David Kastrup
Eluze <[hidden email]> writes:

> following the instructions in AU:
>
> "Alternatively, if you want to specify a different name for the upgraded
> file, preserving the original file and name unchanged, use
>
> convert-ly myfile.ly > mynewfile.ly
> "
>
> I get (under windows 7)
>
>
> close failed: [Errno 9] Bad file descriptor
>
> with an older version there is:
>
> convert-ly.py (GNU LilyPond) 2.14.2
> Processing `myfile.ly'...
> Applying conversion: convert-ly.py: error: : Unable to open file
> convert-ly.py: error: : Unable to open file
> convert-ly.py: error: : Unable to open file
> convert-ly.py: error: : Unable to open file
> convert-ly.py: error: : Unable to open file
> convert-ly.py: error: : Unable to open file
> convert-ly.py: error: : Unable to open file
>
> anything known about that?

I don't know anything about the Windows command line.  What happens if
you remove the space between > and mynewfile.ly ?

--
David Kastrup


_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond
Reply | Threaded
Open this post in threaded view
|

Re: convert-ly from the commandline under windows corrupted?

Eluze
dak wrote
Eluze <[hidden email]> writes:

> convert-ly myfile.ly > mynewfile.ly
> "
I don't know anything about the Windows command line.  What happens if
you remove the space between > and mynewfile.ly ?
I tried all variations - same result - Eluze
Reply | Threaded
Open this post in threaded view
|

Re: convert-ly from the commandline under windows corrupted?

pkx166h
In reply to this post by Eluze
hello,


On 16 August 2013 12:07, Eluze <[hidden email]> wrote:

> following the instructions in AU:
>
> "Alternatively, if you want to specify a different name for the upgraded
> file, preserving the original file and name unchanged, use
>
> convert-ly myfile.ly > mynewfile.ly
> "
>
> I get (under windows 7)
>
>
> close failed: [Errno 9] Bad file descriptor
>
> with an older version there is:
>
> convert-ly.py (GNU LilyPond) 2.14.2
> Processing `myfile.ly'...
> Applying conversion: convert-ly.py: error: : Unable to open file
> convert-ly.py: error: : Unable to open file
> convert-ly.py: error: : Unable to open file
> convert-ly.py: error: : Unable to open file
> convert-ly.py: error: : Unable to open file
> convert-ly.py: error: : Unable to open file
> convert-ly.py: error: : Unable to open file
>
> anything known about that?
>
> Eluze
>
>
>
> --
> View this message in context:
> http://lilypond.1069038.n5.nabble.com/convert-ly-from-the-commandline-under-windows-corrupted-tp149284.html
> Sent from the Bugs mailing list archive at Nabble.com.
>
>
See:

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/redirection.mspx?mfr=true

Do any of these others work? I am guessing this is (yet another) imitation
of the cmd environment and you need to use a different re-direct or some
odd use of quotes.

Out of curiosity (as you on Windows 7) if you run

powershell

Then get that PS env.

then issue the convert command there does this work?

James
_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond
Reply | Threaded
Open this post in threaded view
|

Re: convert-ly from the commandline under windows corrupted?

Phil Holmes
In reply to this post by Eluze
"Eluze" <[hidden email]> wrote in message
news:[hidden email]...
> following the instructions in AU:
>
> "Alternatively, if you want to specify a different name for the upgraded
> file, preserving the original file and name unchanged, use
>
> convert-ly myfile.ly > mynewfile.ly
> "
>
> I get (under windows 7)

I think Windows 7 changed the permissions on some directories - particularly
the "Program Files" directories.  It was an attempt to stop malware writing
to these directories.  What happens if you try convert-ly myfile.ly >
c:\ANewDirectory\mynewfile.ly

--
Phil Holmes
Bug Squad



_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond
Reply | Threaded
Open this post in threaded view
|

Re: convert-ly from the commandline under windows corrupted?

Eluze
Phil Holmes-2 wrote
I think Windows 7 changed the permissions on some directories - particularly
the "Program Files" directories.  It was an attempt to stop malware writing
to these directories.  What happens if you try convert-ly myfile.ly >
c:\ANewDirectory\mynewfile.ly
I'm on drive d: (not where the programs reside)

ICACLS shows I havn't full rights on all:

 VORDEFINIERT\Benutzer:(OI)(CI)(RX)    (RX means read and execute)

so I guess I'll have to find out how to change that - unless somebody can tell me.

under POWERSHELL it works - so maybe I'll have to execute such programs under ps (but I've no idea how this works)?!

thanks for the hints!

Eluze
Reply | Threaded
Open this post in threaded view
|

Re: convert-ly from the commandline under windows corrupted?

pkx166h
Hello,


On 16 August 2013 13:13, Eluze <[hidden email]> wrote:

> Phil Holmes-2 wrote
> > I think Windows 7 changed the permissions on some directories -
> > particularly
> > the "Program Files" directories.  It was an attempt to stop malware
> > writing
> > to these directories.  What happens if you try convert-ly myfile.ly >
> > c:\ANewDirectory\mynewfile.ly
>
> I'm on drive d: (not where the programs reside)
>
> ICACLS shows I havn't full rights on all:
>
>  VORDEFINIERT\Benutzer:(OI)(CI)(RX)    (RX means read and execute)
>
> so I guess I'll have to find out how to change that - unless somebody can
> tell me.
>
> under POWERSHELL it works - so maybe I'll have to execute such programs
> under ps (but I've no idea how this works)?!
>
> thanks for the hints!
>

Powershell is more of a real shell than the cmd window is.I cannot find a
decent link but this is quite good

http://stackoverflow.com/questions/573623/is-powershell-ready-to-replace-my-cygwin-shell-on-windows/573861#573861

It seems that text processing in PS is much more 'like' a UNIX shell
whereas cmd is not. I expect that the limits that we document in the AU doc
about quotes and double quotes are 'probably' not an issue in PS env.

The difference mainly is that in PS there are already pre-build cmdlets
that you cannot get in just the cmd prompt. It's more powerful for Windows
users than the cmd prompt is. For lilypond though it may be simply a way
for NIX users to run some of the commands on Windows without the unexpected
results.

I've never really tried.

James
_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond
Reply | Threaded
Open this post in threaded view
|

Re: convert-ly from the commandline under windows corrupted?

Eluze
In reply to this post by Phil Holmes
Phil Holmes-2 wrote
"Eluze" <[hidden email]> wrote in message
news:[hidden email]...
> following the instructions in AU:
>
> "Alternatively, if you want to specify a different name for the upgraded
> file, preserving the original file and name unchanged, use
>
> convert-ly myfile.ly > mynewfile.ly
> "
>
> I get (under windows 7)

I think Windows 7 changed the permissions on some directories - particularly
the "Program Files" directories.  It was an attempt to stop malware writing
to these directories.  What happens if you try convert-ly myfile.ly >
c:\ANewDirectory\mynewfile.ly
ok, now I've changed the access rights which is confirmed by the command

icacls mynewfile.ly:

mynewfile.ly NT-AUTORITÄT\Authentifizierte Benutzer:(I)(F)
             NT-AUTORITÄT\SYSTEM:(I)(F)
             VORDEFINIERT\Administratoren:(I)(F)
             VORDEFINIERT\Benutzer:(I)(F)

but it still doesn't work

can anybody confirm this behavior or is it only my installation?

thanks
Eluze
Reply | Threaded
Open this post in threaded view
|

Re: convert-ly from the commandline under windows corrupted?

Phil Holmes
"Eluze" <[hidden email]> wrote in message
news:[hidden email]...

> Phil Holmes-2 wrote
>> "Eluze" &lt;
>
>> eluzew@
>
>> &gt; wrote in message
>> news:
>
>> 1376651267219-149284.post@.nabble
>
>> ...
>>> following the instructions in AU:
>>>
>>> "Alternatively, if you want to specify a different name for the upgraded
>>> file, preserving the original file and name unchanged, use
>>>
>>> convert-ly myfile.ly > mynewfile.ly
>>> "
>>>
>>> I get (under windows 7)
>>
>> I think Windows 7 changed the permissions on some directories -
>> particularly
>> the "Program Files" directories.  It was an attempt to stop malware
>> writing
>> to these directories.  What happens if you try convert-ly myfile.ly >
>> c:\ANewDirectory\mynewfile.ly
>
> ok, now I've changed the access rights which is confirmed by the command
>
> icacls mynewfile.ly:
>
> mynewfile.ly NT-AUTORITÄT\Authentifizierte Benutzer:(I)(F)
>             NT-AUTORITÄT\SYSTEM:(I)(F)
>             VORDEFINIERT\Administratoren:(I)(F)
>             VORDEFINIERT\Benutzer:(I)(F)
>
> but it still doesn't work
>
> can anybody confirm this behavior or is it only my installation?
>
> thanks
> Eluze


I get no problem on Vista.

--
Phil Holmes
Bug Squad



_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond
Reply | Threaded
Open this post in threaded view
|

Re: convert-ly from the commandline under windows corrupted?

Eluze
In reply to this post by Eluze
I forgot to mention the fact that mynewfile.ly is emptied if there was some content in it and saved with 0 Bytes!

hence I conclude it is not an access problem.

I don't know what further information could be helpful - here is the python version:

Python 2.4.5 (#1, Mar 11 2013, 11:08:29)
[GCC 4.1.1] on mingw32


Eluze
Reply | Threaded
Open this post in threaded view
|

Re: convert-ly from the commandline under windows corrupted?

Phil Holmes
"Eluze" <[hidden email]> wrote in message
news:[hidden email]...

>I forgot to mention the fact that mynewfile.ly is emptied if there was some
> content in it and saved with 0 Bytes!
>
> hence I conclude it is not an access problem.
>
> I don't know what further information could be helpful - here is the
> python
> version:
>
> Python 2.4.5 (#1, Mar 11 2013, 11:08:29)
> [GCC 4.1.1] on mingw32
>
>
> Eluze

I presume convert-ly runs OK without the > redirect?  Does dir > dir.txt
work OK?

--
Phil Holmes
Bug Squad



_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond
Reply | Threaded
Open this post in threaded view
|

Re: convert-ly from the commandline under windows corrupted?

Eluze
Phil Holmes-2 wrote
"
I presume convert-ly runs OK without the > redirect?  Does dir > dir.txt
work OK?
yes, with the option -e, and also dir > dir.txt

Eluze
Reply | Threaded
Open this post in threaded view
|

Re: convert-ly from the commandline under windows corrupted?

Phil Holmes
"Eluze" <[hidden email]> wrote in message
news:[hidden email]...
> Phil Holmes-2 wrote
>> "
>> I presume convert-ly runs OK without the > redirect?  Does dir > dir.txt
>> work OK?
>
> yes, with the option -e, and also dir > dir.txt
>
> Eluze


That's quite weird, since the > is a DOS redirection, so shouldn't affect
the output of convert-ly.  What about trying python convert-ly.py instead?

--
Phil Holmes
Bug Squad



_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond
Reply | Threaded
Open this post in threaded view
|

Re: convert-ly from the commandline under windows corrupted?

David Kastrup
In reply to this post by Eluze
Eluze <[hidden email]> writes:

> Phil Holmes-2 wrote
>> "
>> I presume convert-ly runs OK without the > redirect?  Does dir > dir.txt
>> work OK?
>
> yes, with the option -e, and also dir > dir.txt

And without option -e (the output should then just be on-screen)?

--
David Kastrup


_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond
Reply | Threaded
Open this post in threaded view
|

Re: convert-ly from the commandline under windows corrupted?

Eluze
In reply to this post by Phil Holmes
Phil Holmes-2 wrote
That's quite weird, since the > is a DOS redirection, so shouldn't affect
the output of convert-ly.  What about trying python convert-ly.py instead?
all the same

dak wrote
> yes, with the option -e, and also dir > dir.txt

And without option -e (the output should then just be on-screen)?
indeed, it is!

Eluze
Reply | Threaded
Open this post in threaded view
|

Re: convert-ly from the commandline under windows corrupted?

David Kastrup
Eluze <[hidden email]> writes:

> Phil Holmes-2 wrote
>> That's quite weird, since the > is a DOS redirection, so shouldn't affect
>> the output of convert-ly.  What about trying python convert-ly.py instead?
>
> all the same
>
>
> dak wrote
>>> yes, with the option -e, and also dir > dir.txt
>>
>> And without option -e (the output should then just be on-screen)?
>
> indeed, it is!

The > redirection is set up by the shell (or its Windows equivalent).
If convert-ly xxx.ly works fine with output to the screen, while
convert-ly xxx.ly > yyy.ly (where yyy.ly does not exist previously)
causes error messages from convert-ly, then the shell will leave the
file in a state where write calls from python don't succeed.

The corresponding passage in scripts/convert-ly.py reads

    if global_options.edit:
        try:
            os.remove (infile_name + '~')
        except:
            pass
        os.rename (infile_name, infile_name + '~')
        outfile = open (infile_name, 'w')
    else:
        outfile = sys.stdout

    outfile.write (result)
   
    sys.stderr.flush ()

    return errors

which is quite unspectacular.  So either there is still a permission
problem, or your version of Python and Windows just don't cooperate
sensibly on sys.stdout.

In the Python documentation, I read

    The standard streams are in text mode by default. To write or read
    binary data to these, use the underlying binary buffer. For example,
    to write bytes to stdout, use sys.stdout.buffer.write(b'abc'). Using
    io.TextIOBase.detach() streams can be made binary by default. This
    function sets stdin and stdout to binary:

    def make_streams_binary():
        sys.stdin = sys.stdin.detach()
        sys.stdout = sys.stdout.detach()

    Note that the streams can be replaced with objects (like
    io.StringIO) that do not support the buffer attribute or the
    detach() method and can raise AttributeError or
    io.UnsupportedOperation.

But the open calls (both for reading and writing files) don't open in
binary either.  So I can just assume that it is a permission problem
after all.  In UNIX, permissions are negotiated at the time of the
"open" system call.  If "open" succeeds, you can do everything that the
open system call asked for (unless you exceed the allotted quota or
physical space on the device).  I seem to remember that Windows is quite
more iffy about those kinds of thing.


--
David Kastrup


_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond
Reply | Threaded
Open this post in threaded view
|

Re: convert-ly from the commandline under windows corrupted?

Eluze
dak wrote
The corresponding passage in scripts/convert-ly.py reads

    if global_options.edit:
        try:
            os.remove (infile_name + '~')
        except:
            pass
        os.rename (infile_name, infile_name + '~')
        outfile = open (infile_name, 'w')
    else:
        outfile = sys.stdout

    outfile.write (result)
   
    sys.stderr.flush ()

    return errors

which is quite unspectacular.  So either there is still a permission
problem, or your version of Python and Windows just don't cooperate
sensibly on sys.stdout.
after looking up Martin Tarenskeen's indent-ly.py I replaced

    # sys.stderr.flush ()

by

    outfile.close()

and it works!

does that make sense?!

Eluze
Reply | Threaded
Open this post in threaded view
|

Re: convert-ly from the commandline under windows corrupted?

David Kastrup
Eluze <[hidden email]> writes:

> dak wrote
>> The corresponding passage in scripts/convert-ly.py reads
>>
>>     if global_options.edit:
>>         try:
>>             os.remove (infile_name + '~')
>>         except:
>>             pass
>>         os.rename (infile_name, infile_name + '~')
>>         outfile = open (infile_name, 'w')
>>     else:
>>         outfile = sys.stdout
>>
>>     outfile.write (result)
>>    
>>     sys.stderr.flush ()
>>
>>     return errors
>>
>> which is quite unspectacular.  So either there is still a permission
>> problem, or your version of Python and Windows just don't cooperate
>> sensibly on sys.stdout.
>
> after looking up Martin Tarenskeen's indent-ly.py I replaced
>
>     # sys.stderr.flush ()
>
> by
>
>     outfile.close()
>
> and it works!
>
> does that make sense?!

Not to me.  But that's par for the course for Windows.

--
David Kastrup


_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond
Reply | Threaded
Open this post in threaded view
|

Re: convert-ly from the commandline under windows corrupted?

Eluze
In reply to this post by Eluze
sorry, I ran the wrong program

but now I get little more information:

Traceback (most recent call last):
  File "C:\Program Files (x86)\LilyPond\usr\bin\convert-ly.py", line 386, in ?
    main ()
  File "C:\Program Files (x86)\LilyPond\usr\bin\convert-ly.py", line 367, in main
    errors += do_one_file (f)
  File "C:\Program Files (x86)\LilyPond\usr\bin\convert-ly.py", line 320, in do_one_file
    outfile.close()
IOError: [Errno 9] Bad file descriptor


in the end I think this problem is not that important because the only purpose of writing the output to a new file is to keep a copy of the original file.

convert-ly creates such a backup - maybe it's not nice that previous backups are overridden each time convert-ly runs.

should the documentation in AU be readapted?! (omit redirection tips or warn there might be issues with it)

Eluze

Reply | Threaded
Open this post in threaded view
|

Re: convert-ly from the commandline under windows corrupted?

David Kastrup
Eluze <[hidden email]> writes:

> sorry, I ran the wrong program
>
> but now I get little more information:
>
> Traceback (most recent call last):
>   File "C:\Program Files (x86)\LilyPond\usr\bin\convert-ly.py", line 386, in
> ?
>     main ()
>   File "C:\Program Files (x86)\LilyPond\usr\bin\convert-ly.py", line 367, in
> main
>     errors += do_one_file (f)
>   File "C:\Program Files (x86)\LilyPond\usr\bin\convert-ly.py", line 320, in
> do_one_file
>     outfile.close()
> IOError: [Errno 9] Bad file descriptor

Closing stdout is likely not a good idea.  I think it would be
reasonable if convert-ly only closed files it opened itself.

--
David Kastrup


_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond
12