Busted won't recognize certain functions - lua

I'm using the Busted framework to test my lua programs. I have newest busted version
user ~ $ busted --version
2.0.rc12-0
I ran this program (its called etl)
goto statement
::statement::
error loading module 'etl' from file './etl.lua':
./etl.lua:6: '=' expected near 'statement'
edit: I'm pretty sure that busted is referencing lua 5.1 or 5.2, but I only have lua 5.3.3 on my system. So how do I get busted to recognize 5.3.3?
proof I only have lua 5.3.3 on my system
me ~ $ luaver list
==> Installed versions:
==> lua-5.3.3
Update: I had some different versions of lua hidden in another folder that luaver didn't recognize. I deleted those and then busted gave me this every time I tried to run it:
/usr/local/bin/busted: 3: exec: /usr/bin/lua5.1: not found
Then I went to to the busted file in /usr/local/bin/busted and it was like this
#!/bin/sh
exec '/usr/bin/lua5.1' -e 'package.path="/home/sam/.luarocks/share/lua/5.1/?.lua;/home/sam/.luarocks/share/lua/5.1/?/init.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;"..package.path; package.cpath="/home/sam/.luarocks/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/?.so;"..package.cpath' -e 'local k,l,_=pcall(require,"luarocks.loader") _=k and l.add_context("busted","2.0.rc12-1")' '/usr/local/lib/luarocks/rocks/busted/2.0.rc12-1/bin/busted' "$#"
so i need to change all that shit to lua5.3. My lua 5.3 is in /usr/local/bin.
Do I just take that file and start cutting out the 5.1 stuff and replacing it with 5.3 stuff?

Related

Airflow on windows 10 - Module not found errors

I'm new to data science and wanted to do a little tutorial, which requires airflow, among other things. I installed it on windows using git bash in VS Code. I tried running it but it had a problem not being able to load the sqlite3 import
command (module not found error). I figured out that if I added the directory of sqlite3.py to the path, it would run, but now it gives me a similar error: pwd module not found from daemon.py
File "C:\ProgramData\Anaconda3\lib\site-packages\daemon\daemon.py", line 18, in <module>
import pwd
ModuleNotFoundError: No module named 'pwd'
Strange to me that it can't find pwd. Obviously pwd works in both git bash and powershell natively. It seems like a basic universal command. I'd love to learn more about what's going on. I don't want to have to end up adding 100 things to path just to get this program to run. I'd love any insights anyone can provide.
PS I'm using Anaconda.
it's seems to be the side effects of Spawning new Python Daemons .
You likely can fix this by downgrading the Python-Daemon :
pip install python-daemon==2.1.2

How make luaenv and luarocks play together correctly

Me using anyenv for installing all scripting languages versions. Currently using it for perl plenv, node ndenv, python pyenv and just installed the luaenv too. Great, because doesn't pollute the system dirs - everything is installed to my user defined directory.
The luaenv is installed OK, and i could:
$ luaenv install 5.1.5 #installed OK
$ luaenv global 5.1.5 #OK
$ luaenv which lua
/opt/anyenv/envs/luaenv/versions/5.1.5/bin/lua
$ luaenv versions
* 5.1.5 (set by /opt/anyenv/envs/luaenv/version)
$ lua -v
Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
Looks that everything is OK.
Of course want install luarocks too. Unfortunatey, the luaenv itself doesn't provides support for the installtion of the luarocks, (e.g. missing the luaenv install-rocks or something like for the perl: plenv install-cpanm) - so tried follow the quick-start guide, e.g.:
download the sources
./configure
make build
The configure failed with the message about the missing lua.h.
Checking Lua includes...
lua.h not found (looked in /opt/anyenv/envs/luaenv/include, /opt/anyenv/envs/luaenv/include/lua/5.1, /opt/anyenv/envs/luaenv/include/lua5.1)
You may want to use the flag --with-lua or --with-lua-include. See --help.
So, the first bug: the luaenv isn't sets the correct paths. :(
After the:
$ find /opt/anyenv/envs/luaenv -name lua.h -print
/opt/anyenv/envs/luaenv/versions/5.1.5/include/lua.h
tried again with:
$ ./configure --with-lua=/opt/anyenv/envs/luaenv/versions/5.1.5
Now it finishes successfully, so followed with the make build.
Checked the result, of the build in the src/luarocks/site_config.lua
local site_config = {}
site_config.LUAROCKS_PREFIX=[[/usr/local]]
site_config.LUA_INCDIR=[[/opt/anyenv/envs/luaenv/versions/5.1.5/include]]
site_config.LUA_LIBDIR=[[/opt/anyenv/envs/luaenv/versions/5.1.5/lib]]
site_config.LUA_BINDIR=[[/opt/anyenv/envs/luaenv/versions/5.1.5/bin]]
site_config.LUAROCKS_SYSCONFDIR=[[/usr/local/etc/luarocks]]
site_config.LUAROCKS_ROCKS_TREE=[[/usr/local]]
site_config.LUAROCKS_ROCKS_SUBDIR=[[/lib/luarocks/rocks]]
site_config.LUA_DIR_SET=true
site_config.LUAROCKS_UNAME_S=[[Darwin]]
site_config.LUAROCKS_UNAME_M=[[x86_64]]
site_config.LUAROCKS_DOWNLOADER=[[curl]]
site_config.LUAROCKS_MD5CHECKER=[[md5sum]]
return site_config
Which is clearly WRONG. The paths shold NOT point to the /usr/local but somewhere into the versioned directories managed by the luaenv.
I'm an lua-noob. Trying to learn it. But i'm unable to set even the basic environment. :( After a hour of googling giving up and asking here:
How to configure and install luarocks to play correctly with the luaenv and the lua versions installed by the luaenv?

Ejabberd installation strange issue

OS: Debian 8.1 X64
trying to install eJabberd Community server based on this tutorial
At the end of installation, it pops error message
Error: Error running Post Install Script.
The installation may have not completed correctly
What am I doing wrong?
It looks like /bin/sh is Dash on your system (apparently the default since Debian Squeeze). However, the postinstall.sh script inside the package uses brace expansion, which while widely supported in various shells is not required by the POSIX standard, and thus Dash is not in error by not supporting it. The postinstall.sh script should either specify /bin/bash instead of /bin/sh in its first line, or abstain from using Bash-specific features.
You should be able to get a functioning ejabberd install by explicitly running the postinstall script with Bash:
sudo bash /opt/ejabberd-15.07/bin/postinstall.sh

How do I configure Cygwin to search using the PATHEXT environment variable?

I am trying to run Rails under Cygwin but when I type "rails -v" it finds "rails" and throws an error. When I type "rails.bat -v" it works just fine. Either works fine in the native Windows command processor because it uses PATHEXT to identify executables like .BAT.
I added a line to .bash_profile as follows and it is setting the variable, as far as I can tell.
export PATHEXT=".RB;.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC"
This is my output:
$ echo $PATH
/usr/local/bin:/usr/bin:/cygdrive/c/Program Files/Common Files/Microsoft Shared/Windows Live:/cygdrive/c/Program Files (x86)/Common Files/Microsoft Shared/Windows Live:/cygdrive/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Program Files/WIDCOMM/Bluetooth Software:/cygdrive/c/Program Files/WIDCOMM/Bluetooth Software/syswow64:/cygdrive/c/Program Files (x86)/Windows Live/Shared:/cygdrive/c/Program Files/Intel/WiFi/bin:/cygdrive/c/Program Files/Common Files/Intel/WirelessCommon:/cygdrive/c/Program Files/Microsoft Windows Performance Toolkit:/cygdrive/c/Program Files (x86)/QuickTime/QTSystem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files/Microsoft/Web Platform Installer:/cygdrive/c/Program Files/7-Zip:/cygdrive/d/sysinternals:/cygdrive/d/batch:/cygdrive/d/Program Files/Sublime Text 2:/cygdrive/d/RailsInstaller/Ruby1.9.3/bin:/cygdrive/d/RailsInstaller/Git/cmd:/cygdrive/d/RailsInstaller/Git/bin:/usr/bin:/cygdrive/d/batch
18:54~
$ echo $PATHEXT
.RB;.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
18:54~
$ which rails
/cygdrive/d/RailsInstaller/Ruby1.9.3/bin/rails
18:54~
$ which rails.bat
/cygdrive/d/RailsInstaller/Ruby1.9.3/bin/rails.bat
18:55~
$ rails -v
D:\RailsInstaller\Ruby1.9.3\bin\ruby.exe: No such file or directory -- /cygdrive/d/RailsInstaller/Ruby1.9.3/bin/rails (LoadError)
18:55~
$ rails.bat -v
Rails 3.2.11
18:55~
$
It looks like you're using the Railsinstaller ruby binary, which is basically a redistribution of RubyInstaller with some of the essentials for Rails development bundled.
However, everything is actually working as intended.
Cygwin doesn't won't use PATHTEXT because it doesn't need to. In other words, it will call the rails binstub instead of the rails.bat batch file. Since there is a hashbang in the binstubs, cygwin handles the entire execution itself.
Also, the RubyInstaller distribution wasn't compiled for Cygwin. So ruby.exe doesn't understand the look-up of the Cygwin paths. That is why you're getting a LoadError.
In my opinion, you should probably check out this answer by Luis Lavena to a similar question. However, if you really want to, you can recompile Ruby in Cygwin or get a Cygwin Ruby distribution.
(In Windows using RailsInstaller) The only way for me was to do add and alias to the installation path.
alias rails='C:/RailsInstaller/Ruby1.9.3/bin/rails'
Once I typed that within cygwin terminal, it worked just fine.

How to use erlang-examples

I just downloaded Erlang using apt-get onto Ubuntu 10.10. How do I run the examples that come with Erlang (the examples you can get through apt-get install erlang-examples). I tried going to the directory where they were stored and compiling ball.erl, but I got this error:
ball.bea#: error writing file
error
The directory where those examples are stored isn't writeable by normal users. To compile a .erl file, the compiler needs to be able to write out the compiled .beam file.
One way around this is to copy the files to a directory you can write to and compile them there:
$ mkdir erlex
$ cd erlex
$ cp /usr/lib/erlang/lib/gs-1.5.11/examples/src/* .
$ erlc *.erl
You need the erlang-dev package installed for that to work.
You can run the ball example like so:
$ erl -s ball
ball here is the module name, and the Erlang emulator defaults to calling the start/0 function in that module, which is correct in this case.
You don't actually have to compile these examples, however. The Ubuntu erlang-examples package ships with them already compiled:
$ cd /usr/lib/erlang/lib/gs-1.5.11/examples/ebin
$ erl -s ball
After closing the GUI window in each, say q(). to get out of the emulator. This may seem weird to you until you realize that everything about Erlang is designed with long uptimes in mind. The mere fact that the last process the emulator was running has stopped isn't enough reason for the BEAM emulator to shut itself down. Something else might be started in that same emulator later, after all.

Resources