If what you're executing is not something huge, doesn't require (m)any external dependencies, and doesn't have user interaction, you can try to (ab)use Scribunto's console AJAX interface:

$ cat lua.py
#!/usr/bin/env python

import requests
import sys

print requests.post(sys.argv[1], params={
    'format': 'json',
    'action': 'scribunto-console',
    'title': '-',
    'question': sys.stdin.read(),
}).json()['print']
$ cat demo.lua
  language="en"
  label=mw.wikibase.label("Q42")
  print(label)
$ ./lua.py https://en.wikipedia.org/w/api.php < demo.lua
Douglas Adams

$

-Liangent


On Sat, Jan 4, 2014 at 4:45 AM, Denny Vrandečić <vrandecic@gmail.com> wrote:
This would require a locally installable Lua library, which currently does not exist. It would be a great project to do something like this!

The same is true for other languages, but I understand the particular use case you have in mind.




On Thu, Jan 2, 2014 at 1:43 PM, Voß, Jakob <Jakob.Voss@gbv.de> wrote:
Hi,

I'd like to access Wikidata via Lua scripts, so the scripts can later be used in MediaWiki. I only know how to create Lua scripts in the module-namespace in Wikimedia wikis, but I want command line scripts that do not require a full MediaWiki installation. To give a minimal example, this script:

  language="en"
  label=mw.wikibase.label("Q42")
  print(label)

if somehow (?) called from command line (!) should print "Douglas Adams" to stdout.

How to do so?
Jakob

--
Jakob Voß
Verbundzentrale des GBV (VZG)
Abteilung Digitale Bibliothek
Platz der Göttinger Sieben 1
37073 Göttingen
Telefon: (49)551 39-10242
Internet: www.gbv.de

_______________________________________________
Wikidata-tech mailing list
Wikidata-tech@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-tech


_______________________________________________
Wikidata-tech mailing list
Wikidata-tech@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-tech