LUAROCKS on windows installs rocks oddly - linux

On Linux, luarocks installs rocks to
/usr/local/lib/luarocks/rock
and puts a corresponding lua file into
/usr/local/share/lua/5.3
On Windows(LUA 5.1), the rocks are in:
C:\Program Files (x86)\LuaRocks\systree\lib\luarocks
and the lua files are in:
C:\Program Files (x86)\LuaRocks\systree\share\lua\5.1
but lua cannot find them on the windows install.
I must have a PATH problem
This is some of my PATH:
Path=C:\Program Files (x86)\Lua\5.1\lua\;C:\Program Files (x86)\LuaRocks\2.2;C:\Program Files (x86)\LuaRocks\2.2\lua\luarocks;C:\Program Files (x86)\LuaRocks\systree\bin;C:\Perl64\site\bin;C:\UnxUpdts;C:\Perl64\bin;C:\Program Files (x86)\Lua\5.1;C:\Program Files (x86)\Lua\5.1\clibs
I am trying ZeroBraneStudio as the IDE and my system prefs specify this path
path.lua = 'C:\Program Files (x86)\Lua\5.1'
I ran
luarocks install inspect
and that generated the necessary files. Then I wrote this simple test code:
require "inspect"
assert(inspect(1) == "1")
assert(inspect("Hello") == '"Hello"')
and got this error
Program starting as '"E:\Anonamouse\ZeroBraneStudio\bin\lua.exe" -e "io.stdout:setvbuf('no')" "E:\Anonamouse\ZeroBraneStudio\myprograms\DemoInspectModule.lua"'.
Program 'lua.exe' started in 'E:\Anonamouse\ZeroBraneStudio\myprograms' (pid: 14776).
E:\Anonamouse\ZeroBraneStudio\bin\lua.exe: ...namouse\ZeroBraneStudio\myprograms\DemoInspectModule.lua:2: attempt to call global 'inspect' (a nil value)
stack traceback:
...namouse\ZeroBraneStudio\myprograms\DemoInspectModule.lua:2: in main chunk
[C]: at 0x00402a57
Program completed in 0.04 seconds (pid: 14776).
I get the same error when I execute the same simple app directly in the console.(That tells me that PATH variable for lua is working)
What am I missing?

Judging from the error message you quoted the require "inspect" worked just fine, but the module didn't set a global variable inspect. For some time now it has been policy to not set globals from within modules, but instead return something (usually the module table) from the module code, which in turn gets passed down via require. So probably something like
local inspect = require "inspect"
assert(inspect(1) == "1")
assert(inspect("Hello") == '"Hello"')
or
local inspect = require "inspect"
assert(inspect.inspect(1) == "1")
assert(inspect.inspect("Hello") == '"Hello"')
should work.

Related

Sybase 16 startserver failed due to missing libsapcrypto.so

We've installed Sybase 16 Express in our Linux box, it was able to startup right after the installation. When we recently try restarting it with the startserver -f RUN_FILE command, it failed to find the libsapcrypto.so file.
~/sap/ASE-16_0/bin> ../sap/ASE-16_0/bin/dataserver: error while loading shared libraries: libsapcrypto.so: cannot open shared object file: No such file or directory
We searched this file, multiple matches presented in the following paths:
./DM/OCS-16_0/lib3p/libsapcrypto.so
./DM/OCS-16_0/lib3p64/libsapcrypto.so
./DM/OCS-16_0/devlib3p64/libsapcrypto.so
./DM/OCS-16_0/devlib3p/libsapcrypto.so
./DM/REP-16_0/lib64/libsapcrypto.so
./DataAccess/ODBC/lib/libsapcrypto.so
./DataAccess64/ODBC/lib/libsapcrypto.so
./OCS-16_0/lib3p/libsapcrypto.so
./OCS-16_0/lib3p64/libsapcrypto.so
./OCS-16_0/devlib3p64/libsapcrypto.so
./OCS-16_0/devlib3p/libsapcrypto.so
Since this hasn't been answered yet, running this command worked for me:
. /opt/sap/SYBASE.sh
Note the different syntax to make sure the environment variables are set in the terminal session, as opposed to using this syntax:
/opt/sap/SYBASE.sh

RuntimeError: Failed to init API, possibly an invalid tessdata path:<>

I am using windows os. Want to detect the text from an image with fontAttributes by tesserocr. But when I am running the python code, I am getting this error -
RuntimeError: Failed to init API, possibly an invalid tessdata path: C:\Program Files (x86)\Tesseract-OCR\tessdata/
i) I have installed -
tesseract-ocr-w32-setup-v5.0.0-alpha.20190623.exe
//(though my system is 64 bit)
ii) Added to path variable (both system and user path) -
C:\Program Files (x86)\Tesseract-OCR
C:\Program Files (x86)\Tesseract-OCR\tessdata
iii) Created new system path variable - TESSDATA_PREFIX and linked path of
tessdata folder, like -
TESSDATA_PREFIX - C:\Program Files (x86)\Tesseract-OCR\tessdata
import pytesseract
import locale
locale.setlocale(locale.LC_ALL, 'C')
from tesserocr import PyTessBaseAPI, RIL, iterate_level,OEM
with PyTessBaseAPI(oem=OEM.TESSERACT_ONLY,lang='bask') as api:
api.SetImageFile('sugar.png')
api.Recognize()
ri = api.GetIterator()
level = RIL.WORD
for r in iterate_level(ri, level):
attrs = r.WordFontAttributes()
symbol = r.GetUTF8Text(level)
print(symbol,attrs)
with PyTessBaseAPI(oem=OEM.TESSERACT_ONLY,lang='bask') as api:
File "tesserocr.pyx", line 1168, in tesserocr._tesserocr.PyTessBaseAPI.__cinit
__
File "tesserocr.pyx", line 1181, in tesserocr._tesserocr.PyTessBaseAPI._init_a
pi
RuntimeError: Failed to init API, possibly an invalid tessdata path: C:\Program
Files (x86)\Tesseract-OCR\tessdata/
Probably you don't have the .traineddata files in your system. you have to copy it from
C:\Program Files\Tesseract-OCR\tessdata
and paste all the data files to your directory , I'd suggest create a virtual environment ans then use it

Node Module Path Execution Windows 10

$ npm install -g static-server
C:\Users\Stuart's\AppData\Roaming\npm\static-server -> C:\Users\Stuart's\AppData\Roaming\npm\node_modules\static-server\bin\static-server.js
+ static-server#2.2.1
added 13 packages from 6 contributors in 1.238s
Stuart's#Stuarts-PC MINGW64 ~/Documents/GitHub/PIES-Network/dapp (master)
$ static-server
module.js:549
throw err;
^
Error: Cannot find module 'C:\c\Users\Stuart's\AppData\Roaming\npm\node_modules\static-server\bin\static-server.js'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3
clearly "C:\c\User.." is not a correct path to my node modules directory. I have checked my local paths and everything looks fine. Any help is appreciated Thanks
This looks a lot like you have accidentally created a directory called C:\c\Users\Stuart's\AppData\Roaming\npm wherein is located the file static-server.cmd. You have a path variable pointing there also somehow.
When static-server is invoked control is passed to the static-server.cmd batch file at this incorrect location.
node 'C:\c\Users\Stuart's\AppData\Roaming\npm\node_modules\static-server\bin\static-server.js
But static-server.js is located as per your install at:
C:\Users\Stuart's\AppData\Roaming\npm\node_modules\static-server\bin\static-server.js.
In these circumstances you will get exactly the errors shown.
It could be some variation on this and I am happy to help further, but step 1 is to check above because for sure the incorrect path parameter is being passed to node (which of course load and executes static-server.js).
EDIT: Here are some further tests:
Search for all instances of "static-server" on your hard disc.
Trying to do this with Explorer will take a long time.
The best and fastest way is to download a tool called UltraSeach.
Here are the search results from my PC ( I created the extra C:\c directory for test purposes).
Check for multiple versions of static-server.cmd or other executable file of that name.
Using a text editor (like notepad) open each static-server.cmd file and add these ECHO commands at the top
(ie before the line staret with #IF EXIST "%~dp0\node.exe" (
ECHO "File 1 executing"
ECHO "%~dp0"
PAUSE
If more than one version put "File 2", "File 3" etc.
Now type static-server at a command prompt and it should
Echo the message "File n executing"
Echo the directory it is executing from
Wait for you to press a key to continue.....
Note the directory it is executing from (call it \CURRENT say)
You can see from static-server.cmd that it then starts node
and tried to execute \CURRENT\node_modules\static-server\bin\static-server.js
In your case its not finding static-server.js where node expects to find it.
Look back to search results in step 1 and see where static-server.js is actually located.
Compare this to where node expects to find it in step 5.
Your problem is either that:
The static-server.cmd being executed is located in the wrong place OR
static-server.js is located at the wrong place.
Here is an additional test. Open a command window and navigate to the directory which has static-server.js. As per the screen-shot it is at C:\Users\Brendan\AppData\Roaming\npm\node_modules\static-server\bin in my case.
Then type node static-server.js. This bypasses the static-server.cmd file altogether, and should start the server. Worked in my case.
Let me know how you go!

Win10: ASDF can't load system (ASDF_OUTPUT_TRANSLATION error)

Update 2
I think #faré is right, it's an output translation problem.
So I declared the evironment variable ASDF_OUTPUT_TRANSLATIONS and set it to E:/. Now (asdf:require-system "my-system") yields a different error: Uneven number of components in source to destination mapping: "E:/" which led me to this SO-topic.
Unfortunately, his solution doesn't work for me. So I tried the other answer and set ASDF_OUTPUT_TRANSLATIONS to (:output-translations (t "E:/")). Now I get yet another error:
Invalid source registry (:OUTPUT-TRANSLATIONS (T "E:/")).
One and only one of
:INHERIT-CONFIGURATION or
:IGNORE-INHERITED-CONFIGURATION
is required.
(will be skipped)
Original Posting
I have a simple system definition but can't get ASDF to load it.
(asdf-version 3.1.5, sbcl 1.3.12 (upgraded to 1.3.18 AMD64), slime 2.19, Windows 10)
What I have tried so far
Following the ASDF manual: "4.1 Configuring ASDF to find your systems"
There it says:
For Windows users, and starting with ASDF 3.1.5, start from your
%LOCALAPPDATA%, which is usually ~/AppData/Local/ (but you can ask in
a CMD.EXE terminal echo %LOCALAPPDATA% to make sure) and underneath
create a subpath config/common-lisp/source-registry.conf.d/
That's exactly what I did:
Echoing %LOCALAPPDATA% which evaluates to C:\Users\my-username\AppData\Local
Underneath I created the subfolders config\common-lisp\source-registry.conf.d\ (In total: C:\Users\my-username\AppData\Local\config\common-lisp\source-registry.conf.d\
The manual continues:
there create a file with any name of your choice but with the type conf, for instance 50-luser-lisp.conf; in this file, add the following line to tell ASDF to recursively scan all the subdirectories under /home/luser/lisp/ for .asd files: (:tree "/home/luser/lisp/")
That’s enough. You may replace /home/luser/lisp/ by wherever you want to install your source code.
In the source-registry.conf.d folder I created the file my.conf and put in it (:tree "C:/Users/my-username/my-systems/"). This folder contains a my-system.asd.
And here comes the weird part:
If I now type (asdf:require-system "my-system") in the REPL I get the following error:
Can't create directory C:\Users\my-username\AppData\Local\common-lisp\sbcl-1.3.12-win-x86\C\Users\my-username\my-systems\C:\
So the problem is not that ASDF doesn't find the file, it does -- but (whatever the reason) it tries to create a really weird subfolder hierarchy which ultimately fails because at the end it tries to create the folder C: but Windows doesn't allow foldernames containing a colon.
Another approach: (push path asdf:*central-registry*)
If I try
> (push #P"C:/Users/my-username/my-systems/" asdf:*central-registry*)
(#P"C:/Users/my-username/my-systems/"
#P"C:/Users/my-username/AppData/Roaming/quicklisp/quicklisp/")
> (asdf:require-system "my-system")
I get the exact same error.
I don't know what to do.
Update
Because of the nature of the weird path ASDF was trying to create I thought maybe I could bypass the problem by specifying a relative path instead of an absolute one.
So I tried
  (:tree "\\Users\\my-username\\my-systems")
in my conf file. Still the same error.
Ahem. It looks like an output-translations problem.
I don't have a Windows machine right now, but this all used to work last time I tried.
Can you setup some ad hoc output-translations for now that will make it work?

How do I include this directory in the $PATH env var?

I'm building a package for Github's Atom editor and Im running into a challenge trying to get a child process to execute with node js. I'm pretty sure that the problem is that the environment that Atom runs in, doesn't include the path to the mrt script. So when I run this from within my package:
exec = require("child_process").exec
child = undefined
child = exec("/usr/local/bin/mrt add iron-router", { cwd: path },(error, stdout, stderr) -
console.log "stdout: " + stdout
console.log "stderr: " + stderr
console.log "exec error: " + error if error isnt null
return
)
in the console, I get:
Atom has a web inspector built right into it and you can actually see the Paths that atom has included. So when I go to Atom's console and type: process.env.PATH it shows the paths: /usr/bin:/bin:/usr/sbin:/sbin. So I somehow need to make atom aware of that mrt script's path. Anyone know how I might go about doing that?
I also reached out on on Atom's discussion forum yesterday, but have yet to come up with a solution.
Edit:
I should also note that the normal command for excuting the mrt package installer is mrt add package-name but as advised on Atom's discussion forum, I've been using the full path.
Edit 2:
I've creating symlinks to node in my /usr/bin directory, and it's working now. Now I'm trying to get node to create the symlinks for me using fs.symlink but that doesn't seem to be working.
To sum it up, the problem is that Atom uses PATH from where it is launched. Consequently, the path to node and the path to mrt where not included in Atom's path. The solution came to me when someone on the Atom Discussion forum pointed out Atom's Class BufferedNodeProcess.
At the time of Answer there is a slight bug with that class so I was not able to use it - the Github team works fast, I wouldn't be surprised if it was fixed within the next couple days. I was, however, able use some of the code to get Atom's environments. Also, I ended up using node's spawn method instead of execute since that's what BufferedNodeProcess uses. Plus you can read each individual line of the stdout.
options =
cwd: atom.project.getPath()
options.env = Object.create(process.env) unless options.env?
options.env["ATOM_SHELL_INTERNAL_RUN_AS_NODE"] = 1
node = (if process.platform is "darwin" then path.resolve(process.resourcesPath, "..", "Frameworks", "Atom Helper.app", "Contents", "MacOS", "Atom Helper") else process.execPath)
mrt = spawn(node, [
"/usr/local/lib/node_modules/meteorite/bin/mrt.js"
"add"
"iron-router"
], options )
mrt.stdout.on "data", (data) ->
console.log "stdout: " + data
return
mrt.stderr.on "data", (data) ->
console.log "stderr: " + data
return
mrt.on "close", (code) ->
console.log "child process exited with code " + code
return

Resources