Hi everyone, I’m currently experiencing problems with PipeableOSProcess. I’m using a command to run a third party tool, which reads a txt file and returns an XML string. In my collection, this works fine for about 75 out of 100 txt files, but fails on the remaining 25 ones. However, the tool itself doesn’t fail. It works fine, if I issue the commands directly from a Terminal. Here’s an example of a command string that works: /Users/silas/Documents/ExtendedEggShell/Moose6.0/ExtendedEggShell/tools/mac/parsecit/bin/citeExtract.pl -m extract_all /Users/silas/Documents/ExtendedEggShell/Moose6.0/ExtendedEggShell/examplePDFsFromList/Ache00aScriptingCoordStyles.pdf.txt And here’s an example of one that doesn’t work. /Users/silas/Documents/ExtendedEggShell/Moose6.0/ExtendedEggShell/tools/mac/parsecit/bin/citeExtract.pl -m extract_all /Users/silas/Documents/ExtendedEggShell/Moose6.0/ExtendedEggShell/examplePDFsFromList/Ardi97aSchemeTeaching.pdf.txt This is how I apply these commands through PipeableOSProcess: xml := (PipeableOSProcess command: cmdString) output. For the first command, xml is a large XML string, for the second command, it’s just an empty string. As I’ve mentioned above, both commands work just fine in a Terminal. They both produce a correct XML string. Does anyone have an idea why this could be the case? Is there a way to access errors in the PipeableOSProcess, if there are any? Is there a better way to issue terminal commands from Pharo? Thanks for your help! Cheers, Silas |
On Wed, Mar 1, 2017 at 8:47 PM, Silas Berger <[hidden email]> wrote: > > Hi everyone, > > > > I’m currently experiencing problems with PipeableOSProcess. I’m using a command to run a third party tool, which reads a txt file and returns an XML string. In my collection, this works fine for about 75 out of 100 txt files, but fails on the remaining 25 ones. However, the tool itself doesn’t fail. It works fine, if I issue the commands directly from a Terminal. > > > > Here’s an example of a command string that works: > > /Users/silas/Documents/ExtendedEggShell/Moose6.0/ExtendedEggShell/tools/mac/parsecit/bin/citeExtract.pl -m extract_all /Users/silas/Documents/ExtendedEggShell/Moose6.0/ExtendedEggShell/examplePDFsFromList/Ache00aScriptingCoordStyles.pdf.txt > > > > And here’s an example of one that doesn’t work. > > /Users/silas/Documents/ExtendedEggShell/Moose6.0/ExtendedEggShell/tools/mac/parsecit/bin/citeExtract.pl -m extract_all /Users/silas/Documents/ExtendedEggShell/Moose6.0/ExtendedEggShell/examplePDFsFromList/Ardi97aSchemeTeaching.pdf.txt > > > > This is how I apply these commands through PipeableOSProcess: > > > > xml := (PipeableOSProcess command: cmdString) output. > > > > For the first command, xml is a large XML string, for the second command, it’s just an empty string. Sorry I don't know the answers your seek - but just to clarify something. How significant is that empty string return? cheers -ben |
In reply to this post by Silas Berger
Hi Silas,
I am travelling and cannot help much right now, but to answer one of your questions - yes, you can inspect errors in a PipeableOSProcess. It has an "error pipeline stream" that will contain any output from the stderr stream of the process. It also has a process proxy for the actual external OS process, which will show exit status for the process. In your case that probably will not help much, because you will just see exit status for the /bin/shell that you ran, not for the process that ran your perl script. Nevertheless it may be interesting to check it. One possible source of problems in a case like this is command line parsing. The command line that you pass from Pharo may get parsed differently than a normal bash terminal shell, especially with respect to quoting strings. Also, you refer to an empty string, which certainly sounds like it is related to the problem, although I cannot say why. Dave > Hi everyone, > > > > I'm currently experiencing problems with PipeableOSProcess. I'm using a > command to run a third party tool, which reads a txt file and returns an > XML > string. In my collection, this works fine for about 75 out of 100 txt > files, > but fails on the remaining 25 ones. However, the tool itself doesn't fail. > It works fine, if I issue the commands directly from a Terminal. > > > > Here's an example of a command string that works: > > /Users/silas/Documents/ExtendedEggShell/Moose6.0/ExtendedEggShell/tools/mac/ > parsecit/bin/citeExtract.pl -m extract_all > /Users/silas/Documents/ExtendedEggShell/Moose6.0/ExtendedEggShell/examplePDF > sFromList/Ache00aScriptingCoordStyles.pdf.txt > > > > And here's an example of one that doesn't work. > > /Users/silas/Documents/ExtendedEggShell/Moose6.0/ExtendedEggShell/tools/mac/ > parsecit/bin/citeExtract.pl -m extract_all > /Users/silas/Documents/ExtendedEggShell/Moose6.0/ExtendedEggShell/examplePDF > sFromList/Ardi97aSchemeTeaching.pdf.txt > > > > This is how I apply these commands through PipeableOSProcess: > > > > xml := (PipeableOSProcess command: cmdString) output. > > > > For the first command, xml is a large XML string, for the second command, > it's just an empty string. As I've mentioned above, both commands work > just > fine in a Terminal. They both produce a correct XML string. > > > > Does anyone have an idea why this could be the case? Is there a way to > access errors in the PipeableOSProcess, if there are any? Is there a > better > way to issue terminal commands from Pharo? > > > > Thanks for your help! > > > > Cheers, > > Silas > > |
In reply to this post by Silas Berger
Hi Dave Okay, great, thanks for your pointers. I found the error stream. The error says /bin/sh: /Users/silas/Documents/ExtendedEggShell/Moose6.0/ExtendedEggShell/tools/mac/parsecit/bin/citeExtract.pl -m extract_all /Users/silas/Documents/ExtendedEggShell/Moose6.0/ExtendedEggShell/examplePDFsFromList/Ardi97aSchemeTeaching.pdf.txt: No such file or directory I’ll have to investigate on why this happens for one .txt file, but not for the other one (Ache00aScriptingCoordStyles.pdf.txt) in the same folder, even though I can’t see any notable differences (like spaces, quotes, …) between the two filenames… Thanks again for your help! Silas Hi Silas, I am travelling and cannot help much right now, but to answer one of your questions - yes, you can inspect errors in a PipeableOSProcess. It has an "error pipeline stream" that will contain any output from the stderr stream of the process. It also has a process proxy for the actual external OS process, which will show exit status for the process. In your case that probably will not help much, because you will just see exit status for the /bin/shell that you ran, not for the process that ran your perl script. Nevertheless it may be interesting to check it. One possible source of problems in a case like this is command line parsing. The command line that you pass from Pharo may get parsed differently than a normal bash terminal shell, especially with respect to quoting strings. Also, you refer to an empty string, which certainly sounds like it is related to the problem, although I cannot say why. Dave > Hi everyone, > > > > I'm currently experiencing problems with PipeableOSProcess. I'm using a > command to run a third party tool, which reads a txt file and returns an > XML > string. In my collection, this works fine for about 75 out of 100 txt > files, > but fails on the remaining 25 ones. However, the tool itself doesn't fail. > It works fine, if I issue the commands directly from a Terminal. > > > > Here's an example of a command string that works: > > /Users/silas/Documents/ExtendedEggShell/Moose6.0/ExtendedEggShell/tools/mac/ > parsecit/bin/citeExtract.pl -m extract_all > /Users/silas/Documents/ExtendedEggShell/Moose6.0/ExtendedEggShell/examplePDF > sFromList/Ache00aScriptingCoordStyles.pdf.txt > > > > And here's an example of one that doesn't work. > > /Users/silas/Documents/ExtendedEggShell/Moose6.0/ExtendedEggShell/tools/mac/ > parsecit/bin/citeExtract.pl -m extract_all > /Users/silas/Documents/ExtendedEggShell/Moose6.0/ExtendedEggShell/examplePDF > sFromList/Ardi97aSchemeTeaching.pdf.txt > > > > This is how I apply these commands through PipeableOSProcess: > > > > xml := (PipeableOSProcess command: cmdString) output. > > > > For the first command, xml is a large XML string, for the second command, > it's just an empty string. As I've mentioned above, both commands work > just > fine in a Terminal. They both produce a correct XML string. > > > > Does anyone have an idea why this could be the case? Is there a way to > access errors in the PipeableOSProcess, if there are any? Is there a > better > way to issue terminal commands from Pharo? > > > > Thanks for your help! > > > > Cheers, > > Silas > > |
Free forum by Nabble | Edit this page |