ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Problem calling system
@ 2012-05-14  8:56 Procházka Lukáš Ing. - Pontex s. r. o.
  2012-05-14 10:11 ` Hans Hagen
  0 siblings, 1 reply; 11+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2012-05-14  8:56 UTC (permalink / raw)
  To: ConTeXt

[-- Attachment #1: Type: text/plain, Size: 757 bytes --]

Hello,

I'd need to call the OS, namely lua in it.

I have the following code:

----
\write18{lua -e "require 'lfs'"}
\write18{lua -e require'lfs'}

\starttext
   A
\stoptext
----

When calling directly from the command line

lua -e "require 'lfs'"

- there is no error.

 From within the Context code, I'm getting (see CmdLine.log):

"
...
lua.exe: (command line):1: '=' expected near 'lfs'
lua.exe: (command line):1: '=' expected near '<eof>'...
"

What could be the problem?

My OS is WinXP 32b.

Best regards,

Lukas


-- 
Ing. Lukáš Procházka [mailto:LPr@pontex.cz]
Pontex s. r. o.      [mailto:pontex@pontex.cz] [http://www.pontex.cz]
Bezová 1658
147 14 Praha 4

Tel: +420 244 062 238
Fax: +420 244 461 038

[-- Attachment #2: t1.log --]
[-- Type: application/octet-stream, Size: 12013 bytes --]

(t1.mkiv

ConTeXt  ver: 2012.04.26 22:27 MKIV  fmt: 2012.4.30  int: english/english

system          > cont-new.mkiv loaded
(c:/ConTeXt/tex/texmf-context/tex/context/base/cont-new.mkiv
system          > beware: some patches loaded from cont-new.mkiv
)
system          > t1.top loaded

system          > options > start used options

used options    > % runtime options files (command line driven)
used options    > \unprotect
used options    > % feedback and basic job control
used options    > % handy for special styles
used options    > \startluacode
used options    > document = document or { }
used options    > document.arguments={
used options    > }
used options    > document.files={
used options    >  "t1.mkiv",
used options    > }
used options    > \stopluacode
used options    > % process info
used options    > \setupsystem[inputfile=t1.mkiv]
used options    > \setupsystem[\c!n=1,\c!m=1]
used options    > % modes
used options    > % options (not that important)
used options    > \startsetups *runtime:options
used options    > \stopsetups
used options    > % styles and modules
used options    > \startsetups *runtime:modules
used options    > \stopsetups
used options    > % done
used options    > \protect \endinput

system          > options > stop used options

(t1.top)
fonts           > latin modern fonts are not preloaded
languages       > language en is active
{c:/ConTeXt/tex/texmf-context/fonts/map/pdftex/context/mkiv-base.map}
fonts           > preloading latin modern fonts (second stage)
fonts           > typescripts > unknown: library 'loc'
{c:/ConTeXt/tex/texmf/fonts/map/dvips/lm/lm-math.map}{c:/ConTeXt/tex/texmf/fonts/map/dvips/lm/lm-rm.map}
fonts           > virtual math > unable to resolve name mapsfromchar
fonts           > fallback modern rm 12pt is loaded
backend         > xmp > using file 'c:/ConTeXt/tex/texmf-context/tex/context/base/lpdf-pdx.xml'
runsystem(lua -e "require 'lfs'")...executed.

runsystem(lua -e require'lfs')...executed.

pages           > flushing realpage 1, userpage 1
 )<c:/ConTeXt/tex/texmf/fonts/opentype/public/lm/lmroman12-regular.otf>

system          > files > start used files

used files      >    1: filename=t1.mkiv | foundname=t1.mkiv | usedmethod=direct
used files      >    2: filename=cont-new.mkiv | filetype=tex | foundname=c:/ConTeXt/tex/texmf-context/tex/context/base/cont-new.mkiv | usedmethod=otherwise
used files      >    3: filename=t1.top | foundname=t1.top | usedmethod=direct
used files      >    4: filename=lang-us.lua | filetype=lua | foundname=c:/ConTeXt/tex/texmf-context/tex/context/patterns/lang-us.lua | usedmethod=otherwise
used files      >    5: filename=mkiv-base.map | filetype=map | format=map | foundname=c:/ConTeXt/tex/texmf-context/fonts/map/pdftex/context/mkiv-base.map | usedmethod=otherwise
used files      >    6: filename=lm.lfg | filetype=tex | foundname=c:/ConTeXt/tex/texmf-context/tex/context/fonts/lm.lfg | usedmethod=otherwise
used files      >    7: filename=lm-math.lfg | filetype=tex | foundname=c:/ConTeXt/tex/texmf-context/tex/context/fonts/lm-math.lfg | usedmethod=otherwise
used files      >    8: filename=lm-math.map | filetype=map | format=map | foundname=c:/ConTeXt/tex/texmf/fonts/map/dvips/lm/lm-math.map | usedmethod=otherwise
used files      >    9: filename=lm-rm.map | filetype=map | format=map | foundname=c:/ConTeXt/tex/texmf/fonts/map/dvips/lm/lm-rm.map | usedmethod=otherwise
used files      >   10: filename=lmroman12-regular | filetype=otf | format=otf | foundname=c:/ConTeXt/tex/texmf/fonts/opentype/public/lm/lmroman12-regular.otf | usedmethod=otherwise
used files      >   11: filename=lmroman7-regular.otf | filetype=otf | format=otf | foundname=c:/ConTeXt/tex/texmf/fonts/opentype/public/lm/lmroman7-regular.otf | usedmethod=otherwise
used files      >   12: filename=rm-lmr7.tfm | filetype=tfm | format=tfm | foundname=c:/ConTeXt/tex/texmf/fonts/tfm/public/lm/rm-lmr7.tfm | usedmethod=otherwise
used files      >   13: filename=lmmi7.tfm | filetype=tfm | format=tfm | foundname=c:/ConTeXt/tex/texmf/fonts/tfm/public/lm/lmmi7.tfm | usedmethod=otherwise
used files      >   14: filename=lmsy7.tfm | filetype=tfm | format=tfm | foundname=c:/ConTeXt/tex/texmf/fonts/tfm/public/lm/lmsy7.tfm | usedmethod=otherwise
used files      >   15: filename=lmex10.tfm | filetype=tfm | format=tfm | foundname=c:/ConTeXt/tex/texmf/fonts/tfm/public/lm/lmex10.tfm | usedmethod=otherwise
used files      >   16: filename=msam7.tfm | filetype=tfm | format=tfm | foundname=c:/ConTeXt/tex/texmf/fonts/tfm/public/amsfonts/symbols/msam7.tfm | usedmethod=otherwise
used files      >   17: filename=msbm7.tfm | filetype=tfm | format=tfm | foundname=c:/ConTeXt/tex/texmf/fonts/tfm/public/amsfonts/symbols/msbm7.tfm | usedmethod=otherwise
used files      >   18: filename=stmary10.afm | filetype=afm | format=afm | foundname=c:/ConTeXt/tex/texmf/fonts/afm/public/stmaryrd/stmary10.afm | usedmethod=otherwise
used files      >   19: filename=stmary10.pfb | filetype=pfb | format=pfb | foundname=c:/ConTeXt/tex/texmf/fonts/type1/public/stmaryrd/stmary10.pfb | usedmethod=otherwise
used files      >   20: filename=lmroman7-bold.otf | filetype=otf | format=otf | foundname=c:/ConTeXt/tex/texmf/fonts/opentype/public/lm/lmroman7-bold.otf | usedmethod=otherwise
used files      >   21: filename=lmmib7.tfm | filetype=tfm | format=tfm | foundname=c:/ConTeXt/tex/texmf/fonts/tfm/public/lm/lmmib7.tfm | usedmethod=otherwise
used files      >   22: filename=lmsans8-regular.otf | filetype=otf | format=otf | foundname=c:/ConTeXt/tex/texmf/fonts/opentype/public/lm/lmsans8-regular.otf | usedmethod=otherwise
used files      >   23: filename=lmmono8-regular.otf | filetype=otf | format=otf | foundname=c:/ConTeXt/tex/texmf/fonts/opentype/public/lm/lmmono8-regular.otf | usedmethod=otherwise
used files      >   24: filename=eufm7.tfm | filetype=tfm | format=tfm | foundname=c:/ConTeXt/tex/texmf/fonts/tfm/public/amsfonts/euler/eufm7.tfm | usedmethod=otherwise
used files      >   25: filename=eufb7.tfm | filetype=tfm | format=tfm | foundname=c:/ConTeXt/tex/texmf/fonts/tfm/public/amsfonts/euler/eufb7.tfm | usedmethod=otherwise
used files      >   26: filename=lmroman9-regular.otf | filetype=otf | format=otf | foundname=c:/ConTeXt/tex/texmf/fonts/opentype/public/lm/lmroman9-regular.otf | usedmethod=otherwise
used files      >   27: filename=rm-lmr9.tfm | filetype=tfm | format=tfm | foundname=c:/ConTeXt/tex/texmf/fonts/tfm/public/lm/rm-lmr9.tfm | usedmethod=otherwise
used files      >   28: filename=lmmi9.tfm | filetype=tfm | format=tfm | foundname=c:/ConTeXt/tex/texmf/fonts/tfm/public/lm/lmmi9.tfm | usedmethod=otherwise
used files      >   29: filename=lmsy9.tfm | filetype=tfm | format=tfm | foundname=c:/ConTeXt/tex/texmf/fonts/tfm/public/lm/lmsy9.tfm | usedmethod=otherwise
used files      >   30: filename=msam10.tfm | filetype=tfm | format=tfm | foundname=c:/ConTeXt/tex/texmf/fonts/tfm/public/amsfonts/symbols/msam10.tfm | usedmethod=otherwise
used files      >   31: filename=msbm10.tfm | filetype=tfm | format=tfm | foundname=c:/ConTeXt/tex/texmf/fonts/tfm/public/amsfonts/symbols/msbm10.tfm | usedmethod=otherwise
used files      >   32: filename=lmroman9-bold.otf | filetype=otf | format=otf | foundname=c:/ConTeXt/tex/texmf/fonts/opentype/public/lm/lmroman9-bold.otf | usedmethod=otherwise
used files      >   33: filename=lmmib10.tfm | filetype=tfm | format=tfm | foundname=c:/ConTeXt/tex/texmf/fonts/tfm/public/lm/lmmib10.tfm | usedmethod=otherwise
used files      >   34: filename=lmsans9-regular.otf | filetype=otf | format=otf | foundname=c:/ConTeXt/tex/texmf/fonts/opentype/public/lm/lmsans9-regular.otf | usedmethod=otherwise
used files      >   35: filename=lmmono9-regular.otf | filetype=otf | format=otf | foundname=c:/ConTeXt/tex/texmf/fonts/opentype/public/lm/lmmono9-regular.otf | usedmethod=otherwise
used files      >   36: filename=eufm10.tfm | filetype=tfm | format=tfm | foundname=c:/ConTeXt/tex/texmf/fonts/tfm/public/amsfonts/euler/eufm10.tfm | usedmethod=otherwise
used files      >   37: filename=eufb10.tfm | filetype=tfm | format=tfm | foundname=c:/ConTeXt/tex/texmf/fonts/tfm/public/amsfonts/euler/eufb10.tfm | usedmethod=otherwise
used files      >   38: filename=lmroman12-regular.otf | filetype=otf | format=otf | foundname=c:/ConTeXt/tex/texmf/fonts/opentype/public/lm/lmroman12-regular.otf | usedmethod=otherwise
used files      >   39: filename=rm-lmr12.tfm | filetype=tfm | format=tfm | foundname=c:/ConTeXt/tex/texmf/fonts/tfm/public/lm/rm-lmr12.tfm | usedmethod=otherwise
used files      >   40: filename=lmmi12.tfm | filetype=tfm | format=tfm | foundname=c:/ConTeXt/tex/texmf/fonts/tfm/public/lm/lmmi12.tfm | usedmethod=otherwise
used files      >   41: filename=lmsy10.tfm | filetype=tfm | format=tfm | foundname=c:/ConTeXt/tex/texmf/fonts/tfm/public/lm/lmsy10.tfm | usedmethod=otherwise
used files      >   42: filename=lmroman12-bold.otf | filetype=otf | format=otf | foundname=c:/ConTeXt/tex/texmf/fonts/opentype/public/lm/lmroman12-bold.otf | usedmethod=otherwise
used files      >   43: filename=lmsans12-regular.otf | filetype=otf | format=otf | foundname=c:/ConTeXt/tex/texmf/fonts/opentype/public/lm/lmsans12-regular.otf | usedmethod=otherwise
used files      >   44: filename=lmmono12-regular.otf | filetype=otf | format=otf | foundname=c:/ConTeXt/tex/texmf/fonts/opentype/public/lm/lmmono12-regular.otf | usedmethod=otherwise
used files      >   45: filename=lpdf-pdx.xml | filetype=tex | foundname=c:/ConTeXt/tex/texmf-context/tex/context/base/lpdf-pdx.xml | usedmethod=otherwise

system          > files > stop used files


system          > structure > start used structure

used structure  > text: t1

system          > structure > stop used structure


mkiv lua stats  > used config file          - selfautoparent:texmf/web2c/texmfcnf.lua
mkiv lua stats  > used cache path           - c:/ConTeXt/tex/texmf-cache/luatex-cache/context/2448223e6631addb83df348d74153606
mkiv lua stats  > resource resolver         - loadtime 0.047 seconds, 2 scans with scantime 0.031 seconds, 0 shared scans, 45 found files, scanned paths: C:/Lukas/ConTeXt/Fonts c:/windows/fonts
mkiv lua stats  > stored bytecode data      - 303 modules, 65 tables, 368 chunks
mkiv lua stats  > cleaned up reserved nodes - 39 nodes, 9 lists of 436
mkiv lua stats  > node memory usage         - 2 glue, 2 penalty, 9 attribute, 28 glue_spec, 3 attribute_list
mkiv lua stats  > node list callback tasks  - 6 unique task lists, 5 instances (re)created, 135 calls
mkiv lua stats  > used backend              - pdf (backend for directly generating pdf output)
mkiv lua stats  > loaded patterns           - en::2
mkiv lua stats  > jobdata time              - 0.000 seconds saving, 0.016 seconds loading
mkiv lua stats  > callbacks                 - 258 direct, 559 indirect, 817 total
mkiv lua stats  > randomizer                - resumed with value 0.22919400616474
mkiv lua stats  > lxml preparation time     - 0.000 seconds, 0 nodes, 15 lpath calls, 0 cached calls
mkiv lua stats  > result saved in file      - t1.pdf
mkiv lua stats  > loaded fonts              - 33 files: stmary10.afm lmmono12-regular.otf lmmono8-regular.otf lmmono9-regular.otf lmroman12-bold.otf lmroman12-regular.otf lmroman7-bold.otf lmroman7-regular.otf lmroman9-bold.otf lmroman9-regular.otf lmsans12-regular.otf lmsans8-regular.otf lmsans9-regular.otf eufb10.tfm eufb7.tfm eufm10.tfm eufm7.tfm msam10.tfm msam7.tfm msbm10.tfm msbm7.tfm lmex10.tfm lmmi12.tfm lmmi7.tfm lmmi9.tfm lmmib10.tfm lmmib7.tfm lmsy10.tfm lmsy7.tfm lmsy9.tfm rm-lmr12.tfm rm-lmr7.tfm rm-lmr9.tfm
mkiv lua stats  > fonts load time           - 0.359 seconds 
mkiv lua stats  > luatex banner             - this is luatex, version beta-0.70.1-2012042323 (tex live 2012)
mkiv lua stats  > control sequences         - 33491 of 65536 + 100000
mkiv lua stats  > current memory usage      - 34 MB (ctx: 35 MB)
mkiv lua stats  > runtime                   - 1.266 seconds, 1 processed pages, 1 shipped pages, 0.790 pages/second


[-- Attachment #3: t1.mkiv --]
[-- Type: application/octet-stream, Size: 95 bytes --]

\write18{lua -e "require 'lfs'"}
\write18{lua -e require'lfs'}

\starttext
  A
\stoptext

[-- Attachment #4: CmdLine.log --]
[-- Type: application/octet-stream, Size: 3919 bytes --]

C:\Lukas\ConTeXt\TestDDv>context.exe t1.mkiv

mtx-context     | run 1: luatex --fmt="c:/ConTeXt/tex/texmf-cache/luatex-cache/context/2448223e6631addb83df348d74153606/formats/cont-en" --lua="c:/ConTeXt/tex/texmf-cache/luatex-cache/context/2448223e6631addb83df348d74153606/formats/cont-en.lui" --backend="pdf" "./t1.mkiv" \stoptext
This is LuaTeX, Version beta-0.70.1-2012042323 (TeX Live 2012)
 \write18 enabled.
(t1.mkiv

ConTeXt  ver: 2012.04.26 22:27 MKIV  fmt: 2012.4.30  int: english/english

system          > cont-new.mkiv loaded
(c:/ConTeXt/tex/texmf-context/tex/context/base/cont-new.mkiv
system          > beware: some patches loaded from cont-new.mkiv
)
system          > t1.top loaded
(t1.top)
fonts           > latin modern fonts are not preloaded
languages       > language en is active
{c:/ConTeXt/tex/texmf-context/fonts/map/pdftex/context/mkiv-base.map}
fonts           > preloading latin modern fonts (second stage)
fonts           > typescripts > unknown: library 'loc'
{c:/ConTeXt/tex/texmf/fonts/map/dvips/lm/lm-math.map}{c:/ConTeXt/tex/texmf/fonts/map/dvips/lm/lm-rm.map}
fonts           > virtual math > unable to resolve name mapsfromchar
fonts           > fallback modern rm 12pt is loaded
backend         > xmp > using file 'c:/ConTeXt/tex/texmf-context/tex/context/base/lpdf-pdx.xml'
lua: (command line):1: '=' expected near 'lfs'
lua: (command line):1: '=' expected near '<eof>'
pages           > flushing realpage 1, userpage 1
 )<c:/ConTeXt/tex/texmf/fonts/opentype/public/lm/lmroman12-regular.otf>
mkiv lua stats  > used config file          - selfautoparent:texmf/web2c/texmfcnf.lua
mkiv lua stats  > used cache path           - c:/ConTeXt/tex/texmf-cache/luatex-cache/context/2448223e6631addb83df348d74153606
mkiv lua stats  > resource resolver         - loadtime 0.047 seconds, 2 scans with scantime 0.031 seconds, 0 shared scans, 45 found files, scanned paths: C:/Lukas/ConTeXt/Fonts c:/windows/fonts
mkiv lua stats  > stored bytecode data      - 303 modules, 65 tables, 368 chunks
mkiv lua stats  > cleaned up reserved nodes - 39 nodes, 9 lists of 436
mkiv lua stats  > node memory usage         - 2 glue, 2 penalty, 9 attribute, 28 glue_spec, 3 attribute_list
mkiv lua stats  > node list callback tasks  - 6 unique task lists, 5 instances (re)created, 135 calls
mkiv lua stats  > used backend              - pdf (backend for directly generating pdf output)
mkiv lua stats  > loaded patterns           - en::2
mkiv lua stats  > jobdata time              - 0.000 seconds saving, 0.016 seconds loading
mkiv lua stats  > callbacks                 - 258 direct, 559 indirect, 817 total
mkiv lua stats  > randomizer                - resumed with value 0.22919400616474
mkiv lua stats  > lxml preparation time     - 0.000 seconds, 0 nodes, 15 lpath calls, 0 cached calls
mkiv lua stats  > result saved in file      - t1.pdf
mkiv lua stats  > loaded fonts              - 33 files: stmary10.afm lmmono12-regular.otf lmmono8-regular.otf lmmono9-regular.otf lmroman12-bold.otf lmroman12-regular.otf lmroman7-bold.otf lmroman7-regular.otf lmroman9-bold.otf lmroman9-regular.otf lmsans12-regular.otf lmsans8-regular.otf lmsans9-regular.otf eufb10.tfm eufb7.tfm eufm10.tfm eufm7.tfm msam10.tfm msam7.tfm msbm10.tfm msbm7.tfm lmex10.tfm lmmi12.tfm lmmi7.tfm lmmi9.tfm lmmib10.tfm lmmib7.tfm lmsy10.tfm lmsy7.tfm lmsy9.tfm rm-lmr12.tfm rm-lmr7.t
fm rm-lmr9.tfm
mkiv lua stats  > fonts load time           - 0.359 seconds
mkiv lua stats  > luatex banner             - this is luatex, version beta-0.70.1-2012042323 (tex live 2012)
mkiv lua stats  > control sequences         - 33491 of 65536 + 100000
mkiv lua stats  > current memory usage      - 34 MB (ctx: 35 MB)
mkiv lua stats  > runtime                   - 1.266 seconds, 1 processed pages, 1 shipped pages, 0.790 pages/second

system          | total runtime: 3.109
C:\Lukas\ConTeXt\TestDDv>

[-- Attachment #5: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Problem calling system
  2012-05-14  8:56 Problem calling system Procházka Lukáš Ing. - Pontex s. r. o.
@ 2012-05-14 10:11 ` Hans Hagen
  2012-05-14 10:23   ` Procházka Lukáš Ing. - Pontex s. r. o.
  0 siblings, 1 reply; 11+ messages in thread
From: Hans Hagen @ 2012-05-14 10:11 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 14-5-2012 10:56, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
> Hello,
>
> I'd need to call the OS, namely lua in it.
>
> I have the following code:
>
> ----
> \write18{lua -e "require 'lfs'"}
> \write18{lua -e require'lfs'}
>
> \starttext
> A
> \stoptext
> ----
>
> When calling directly from the command line
>
> lua -e "require 'lfs'"
>
> - there is no error.
>
>  From within the Context code, I'm getting (see CmdLine.log):
>
> "
> ....
> lua.exe: (command line):1: '=' expected near 'lfs'
> lua.exe: (command line):1: '=' expected near '<eof>'...
> "
>
> What could be the problem?
>
> My OS is WinXP 32b.


And how about

\ctxlua{os.execute(lua -e "require 'lfs'")}

btw, if you run texlua you get lfs for free.

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Problem calling system
  2012-05-14 10:11 ` Hans Hagen
@ 2012-05-14 10:23   ` Procházka Lukáš Ing. - Pontex s. r. o.
  2012-05-14 10:54     ` Hans Hagen
  2012-05-15  7:05     ` Procházka Lukáš Ing. - Pontex s. r. o.
  0 siblings, 2 replies; 11+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2012-05-14 10:23 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 1329 bytes --]

> \ctxlua{os.execute(lua -e "require 'lfs'")}

... Gives:

"
...
fonts           > latin modern fonts are not preloaded
languages       > language en is active
! LuaTeX error <main ctx instance>:1: attempt to call global 'e' (a nil value)
stack traceback:
         <main ctx instance>:1: in main chunk.

system          > tex > error on line 4 in file C:/Lukas/ConTeXt/TestDDv/t1.mkiv: LuaTeX error  ...

  1     %\write18{lua -e "require 'lfs'"}
  2     %
  3
  4 >>  \ctxlua{os.execute(lua -e "require 'lfs'")}
  5     %\ctxlua{os.execute([[lua -e "require 'lfs'"]])}
  6
  7     \starttext
  8       A
  9     \stoptext
10

l.4 \ctxlua{os.execute(lua -e "require 'lfs'")}
...
"

If I try:

\ctxlua{os.execute([[lua -e "require 'lfs'"]])}

I get error:

"
...
languages       > language en is active
lua: (command line):1: '=' expected near 'lfs'
{c:/ConTeXt/tex/texmf-context/fonts/map/pdftex/context/mkiv-base.map}
...
"

(Like if "'" were gobbled...)

>
> btw, if you run texlua you get lfs for free.

OK, this is just a sample. I need to use another file, in fact.

Lukas


-- 
Ing. Lukáš Procházka [mailto:LPr@pontex.cz]
Pontex s. r. o.      [mailto:pontex@pontex.cz] [http://www.pontex.cz]
Bezová 1658
147 14 Praha 4

Tel: +420 244 062 238
Fax: +420 244 461 038

[-- Attachment #2: t1.mkiv --]
[-- Type: application/octet-stream, Size: 194 bytes --]

%\write18{lua -e "require 'lfs'"}
%\write18{lua -e require'lfs'}

%\ctxlua{os.execute(lua -e "require 'lfs'")}
\ctxlua{os.execute([[lua -e "require 'lfs'"]])}

\starttext
  A
\stoptext

[-- Attachment #3: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Problem calling system
  2012-05-14 10:23   ` Procházka Lukáš Ing. - Pontex s. r. o.
@ 2012-05-14 10:54     ` Hans Hagen
  2012-05-15  7:05     ` Procházka Lukáš Ing. - Pontex s. r. o.
  1 sibling, 0 replies; 11+ messages in thread
From: Hans Hagen @ 2012-05-14 10:54 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 14-5-2012 12:23, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
>> \ctxlua{os.execute(lua -e "require 'lfs'")}

\ctxlua{os.execute([[lua -e "require 'lfs'"]])}



-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Problem calling system
  2012-05-14 10:23   ` Procházka Lukáš Ing. - Pontex s. r. o.
  2012-05-14 10:54     ` Hans Hagen
@ 2012-05-15  7:05     ` Procházka Lukáš Ing. - Pontex s. r. o.
  2012-05-15  8:14       ` Hans Hagen
  1 sibling, 1 reply; 11+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2012-05-15  7:05 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 818 bytes --]

Hello,

I slightly modified the example - my code now is:

----
\ctxlua{os.execute([[echo lua -e "print 'WWW'"]])}

\starttext
   A
\stoptext
----

So now I'm able to diagnose what exactly is passed to the command line.

I'm getting:

"
...
languages       > language en is active
lua -e "print "WWW""
{c:/ConTeXt/tex/texmf-context/fonts/map/pdftex/context/mkiv-base.map}
...
"

So it can be seen that [surprisingly] character ' was substituted for " - and IMHO this causes the problem.

Could anyone explain why this substitution is performed and how to avoid it?

Best regards,

Lukas


-- 
Ing. Lukáš Procházka [mailto:LPr@pontex.cz]
Pontex s. r. o.      [mailto:pontex@pontex.cz] [http://www.pontex.cz]
Bezová 1658
147 14 Praha 4

Tel: +420 244 062 238
Fax: +420 244 461 038

[-- Attachment #2: t1.mkiv --]
[-- Type: application/octet-stream, Size: 339 bytes --]

%\write18{lua -e "require 'lfs'"}
%\write18{lua -e require'lfs'}

%\ctxlua{os.execute(lua -e "require 'lfs'")}
%\ctxlua{os.execute([[lua -e "require 'lfs'"]])}
%\ctxlua{os.execute([[echo c:/Lukas/Cpp/Projects~/Lua/Debug/Lua.exe -e "print 'WWW'"]])}

\ctxlua{os.execute([[echo lua -e "print 'WWW'"]])}

\starttext
  A
\stoptext

[-- Attachment #3: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Problem calling system
  2012-05-15  7:05     ` Procházka Lukáš Ing. - Pontex s. r. o.
@ 2012-05-15  8:14       ` Hans Hagen
  2012-05-15  8:34         ` Procházka Lukáš Ing. - Pontex s. r. o.
  0 siblings, 1 reply; 11+ messages in thread
From: Hans Hagen @ 2012-05-15  8:14 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 15-5-2012 09:05, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
> Hello,
>
> I slightly modified the example - my code now is:
>
> ----
> \ctxlua{os.execute([[echo lua -e "print 'WWW'"]])}
>
> \starttext
> A
> \stoptext
> ----
>
> So now I'm able to diagnose what exactly is passed to the command line.
>
> I'm getting:
>
> "
> ....
> languages > language en is active
> lua -e "print "WWW""
> {c:/ConTeXt/tex/texmf-context/fonts/map/pdftex/context/mkiv-base.map}
> ....
> "
>
> So it can be seen that [surprisingly] character ' was substituted for "
> - and IMHO this causes the problem.
>
> Could anyone explain why this substitution is performed and how to avoid
> it?

probably some os.execute parsing ... does os.exec or os.spawn work ok?


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Problem calling system
  2012-05-15  8:14       ` Hans Hagen
@ 2012-05-15  8:34         ` Procházka Lukáš Ing. - Pontex s. r. o.
  2012-05-15  9:31           ` Hans Hagen
  2012-05-17  8:52           ` Procházka Lukáš Ing. - Pontex s. r. o.
  0 siblings, 2 replies; 11+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2012-05-15  8:34 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Hans Hagen

> probably some os.execute parsing ...

Do you mean Lua itself does the parsing and substitution? I guessed [lua]tex core...

When I try to call on the command line:

"
C:\Lukas\ConTeXt\TestDDv>lua
Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> os.execute([[lua -e "print 'WWW'"]])
WWW
> os.execute([[echo lua -e "print 'WWW'"]])
lua -e "print 'WWW'"
> =os.exec
nil
> =os.spawn
nil
>
"

- There is no '/" substitution in standalone Lua (?!).

> does os.exec or os.spawn work ok?

Well, the 'os.exec' works, in condition that it is called with "cmd /c":

----
\ctxlua{os.execute([[echo lua -e "print 'EXECUTE'"]])}
\ctxlua{os.exec([[cmd.exe /c echo lua -e "print 'EXEC'"]])}
\ctxlua{os.spawn([[cmd.exe /c echo lua -e "print 'SPAWN'"]])}

\starttext
   A
\stoptext
----

Gives:

"
...
languages       > language en is active
lua -e "print "EXECUTE""
lua -e "print 'EXEC'"

system          | total runtime: 0.609
"

Interesting that the string to be passed to 'os.exec' keeps ' whilst that to 'os.execute' doesn't.

Why this happens?

Anyhow, thanks for the idea with 'os.exec'.

Best regards,

Lukas


-- 
Ing. Lukáš Procházka [mailto:LPr@pontex.cz]
Pontex s. r. o.      [mailto:pontex@pontex.cz] [http://www.pontex.cz]
Bezová 1658
147 14 Praha 4

Tel: +420 244 062 238
Fax: +420 244 461 038

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Problem calling system
  2012-05-15  8:34         ` Procházka Lukáš Ing. - Pontex s. r. o.
@ 2012-05-15  9:31           ` Hans Hagen
  2012-05-15 11:46             ` Procházka Lukáš Ing. - Pontex s. r. o.
  2012-05-17  8:52           ` Procházka Lukáš Ing. - Pontex s. r. o.
  1 sibling, 1 reply; 11+ messages in thread
From: Hans Hagen @ 2012-05-15  9:31 UTC (permalink / raw)
  To: "Procházka Lukáš Ing. - Pontex s. r. o."
  Cc: mailing list for ConTeXt users

On 15-5-2012 10:34, Procházka Lukáš Ing. - Pontex s. r. o. wrote:

> languages > language en is active
> lua -e "print "EXECUTE""
> lua -e "print 'EXEC'"

you can try texlua instead of lua to see what happens

> system | total runtime: 0.609
> "
>
> Interesting that the string to be passed to 'os.exec' keeps ' whilst
> that to 'os.execute' doesn't.
>
> Why this happens?

I dont' know.

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Problem calling system
  2012-05-15  9:31           ` Hans Hagen
@ 2012-05-15 11:46             ` Procházka Lukáš Ing. - Pontex s. r. o.
  2012-05-15 13:19               ` luigi scarso
  0 siblings, 1 reply; 11+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2012-05-15 11:46 UTC (permalink / raw)
  To: ConTeXt

... I also tried:

----
\write18{echo 'AAA'}

\starttext
    A
\stoptext
----

Which gives:

"
...
backend         > xmp > using file 'c:/ConTeXt/tex/texmf-context/tex/context/base/lpdf-pdx.xml'
"AAA"
pages           > flushing realpage 1, userpage 1
...
"

So it can be seen that ' changes to " even in this case. Weird.

Best regards,

Lukas


-- 
Ing. Lukáš Procházka [mailto:LPr@pontex.cz]
Pontex s. r. o.      [mailto:pontex@pontex.cz] [http://www.pontex.cz]
Bezová 1658
147 14 Praha 4

Tel: +420 244 062 238
Fax: +420 244 461 038

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Problem calling system
  2012-05-15 11:46             ` Procházka Lukáš Ing. - Pontex s. r. o.
@ 2012-05-15 13:19               ` luigi scarso
  0 siblings, 0 replies; 11+ messages in thread
From: luigi scarso @ 2012-05-15 13:19 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Tue, May 15, 2012 at 1:46 PM, Procházka Lukáš Ing. - Pontex s. r.
o. <LPr@pontex.cz> wrote:
> ... I also tried:
>
> ----
> \write18{echo 'AAA'}
>
> \starttext
>   A
> \stoptext
> ----
>
> Which gives:
>
> "
> ...
> backend         > xmp > using file
> 'c:/ConTeXt/tex/texmf-context/tex/context/base/lpdf-pdx.xml'
> "AAA"
> pages           > flushing realpage 1, userpage 1
> ...
> "
>
> So it can be seen that ' changes to " even in this case. Weird.
same here, with windows 7 home premium
-- 
luigi
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Problem calling system
  2012-05-15  8:34         ` Procházka Lukáš Ing. - Pontex s. r. o.
  2012-05-15  9:31           ` Hans Hagen
@ 2012-05-17  8:52           ` Procházka Lukáš Ing. - Pontex s. r. o.
  1 sibling, 0 replies; 11+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2012-05-17  8:52 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Hans Hagen

... Finally, I use the following to avoid ' in arguments and to keep " to os.execute():

----
\bgroup
   \catcode`\%=11
   \ctxlua{os.execute(([[echo lua -e "print 'EXECUTE'"]]):gsub("'(.-)'", "[[%1]]"))}
\egroup

% Or:

\startluacode
   os.execute(([[echo lua -e "print 'EXECUTE'"]]):gsub("'(.-)'", "[[%1]]"))
\stopluacode

\starttext
   A
\stoptext
----

None of both solutions are "pure" as I'd imagine but they seem to work.

Best regards,

Lukas


-- 
Ing. Lukáš Procházka [mailto:LPr@pontex.cz]
Pontex s. r. o.      [mailto:pontex@pontex.cz] [http://www.pontex.cz]
Bezová 1658
147 14 Praha 4

Tel: +420 244 062 238
Fax: +420 244 461 038

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-05-17  8:52 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-14  8:56 Problem calling system Procházka Lukáš Ing. - Pontex s. r. o.
2012-05-14 10:11 ` Hans Hagen
2012-05-14 10:23   ` Procházka Lukáš Ing. - Pontex s. r. o.
2012-05-14 10:54     ` Hans Hagen
2012-05-15  7:05     ` Procházka Lukáš Ing. - Pontex s. r. o.
2012-05-15  8:14       ` Hans Hagen
2012-05-15  8:34         ` Procházka Lukáš Ing. - Pontex s. r. o.
2012-05-15  9:31           ` Hans Hagen
2012-05-15 11:46             ` Procházka Lukáš Ing. - Pontex s. r. o.
2012-05-15 13:19               ` luigi scarso
2012-05-17  8:52           ` Procházka Lukáš Ing. - Pontex s. r. o.

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).