[Mod] Raspberry PI MC API for Python code [raspberryjammod]

cvincross
New member
Posts: 4
Joined: Thu Nov 02, 2017 13:53

Re: [Mod] Raspberry PI MC API for Python code [raspberryjamm

by cvincross » Post

have you added "secure.enable_security = true" to your minetest.conf? That is what fixed that error for me.

User avatar
rubenwardy
Moderator
Posts: 6288
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: United Kingdom
Contact:

Re: [Mod] Raspberry PI MC API for Python code [raspberryjamm

by rubenwardy » Post

GRudolph wrote:@jocsamazon
I would like to know what specific changes you made in order to run minetest with raspberryjammod?
I am running Windows 10, Minetest 0.4.17.1 and Python 3.6.5.
I have replaced the mcpipy files as you indicated in your post quoted above, but the mod fails to load with the following error, and as a result, I cannot even test the Python scripts.
So how do I fix this error and proceed
add this to minetest.conf:

Code: Select all

secure.trusted_mods = raspberryjammod
cvincross wrote:have you added "secure.enable_security = true" to your minetest.conf? That is what fixed that error for me.
Don't touch this setting! Mod security should never be disabled

cvincross
New member
Posts: 4
Joined: Thu Nov 02, 2017 13:53

Re: [Mod] Raspberry PI MC API for Python code [raspberryjamm

by cvincross » Post

rubenwardy wrote:
GRudolph wrote:@jocsamazon
I would like to know what specific changes you made in order to run minetest with raspberryjammod?
I am running Windows 10, Minetest 0.4.17.1 and Python 3.6.5.
I have replaced the mcpipy files as you indicated in your post quoted above, but the mod fails to load with the following error, and as a result, I cannot even test the Python scripts.
So how do I fix this error and proceed
add this to minetest.conf:

Code: Select all

secure.trusted_mods = raspberryjammod
cvincross wrote:have you added "secure.enable_security = true" to your minetest.conf? That is what fixed that error for me.
Don't touch this setting! Mod security should never be disabled
My mistake...so specifying this as "true" worked on one machine (oddly)... on another machine it only works with security disabled... which is a BAD idea for sure... but with security enabled I get a "require() is disabled" message. any ideas how to get around that?

This is on the latest 5.0.0dev on linux.

cvincross
New member
Posts: 4
Joined: Thu Nov 02, 2017 13:53

Re: [Mod] Raspberry PI MC API for Python code [raspberryjamm

by cvincross » Post

cvincross wrote:
rubenwardy wrote:
GRudolph wrote:@jocsamazon
I would like to know what specific changes you made in order to run minetest with raspberryjammod?
I am running Windows 10, Minetest 0.4.17.1 and Python 3.6.5.
I have replaced the mcpipy files as you indicated in your post quoted above, but the mod fails to load with the following error, and as a result, I cannot even test the Python scripts.
So how do I fix this error and proceed
add this to minetest.conf:

Code: Select all

secure.trusted_mods = raspberryjammod
cvincross wrote:have you added "secure.enable_security = true" to your minetest.conf? That is what fixed that error for me.
Don't touch this setting! Mod security should never be disabled
My mistake...so specifying this as "true" worked on one machine (oddly)... on another machine it only works with security disabled... which is a BAD idea for sure... but with security enabled I get a "require() is disabled" message. any ideas how to get around that?

This is on the latest 5.0.0dev on linux.
Again...my mistake... I just confirmed I can't get either machine to work with security turned on... so both return the error about require() being disabled by security. Any help would be appreciated. Does turning off security pose a serious security risk if it is being used as a self hosted single player session - ie without the server enabled?

User avatar
rubenwardy
Moderator
Posts: 6288
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: United Kingdom
Contact:

Re: [Mod] Raspberry PI MC API for Python code [raspberryjamm

by rubenwardy » Post

You need to change `require` this:

Code: Select all

local old_require = require
require = ie.require

local socket = require("socket")
-- any other sockets

require = old_require

cvincross
New member
Posts: 4
Joined: Thu Nov 02, 2017 13:53

Re: [Mod] Raspberry PI MC API for Python code [raspberryjamm

by cvincross » Post

rubenwardy wrote:You need to change `require` this:

Code: Select all

local old_require = require
require = ie.require

local socket = require("socket")
-- any other sockets

require = old_require
Ok, I am probably doing this wrong... but I made the above change to the init.lua of the mod and I'm not getting it to work. Am I wrapping just the socket "requires" with this redefinition or all of them? - there are three others that are not "sockets" sprinkled throughout the script. I'm not really clear on what this is accomplishing though...since the calls are already ie.require before I redefine require to be ie.require. please excuse my ignorance. Anyway... when I do this I end up with an error about attempting to index a nil value for "ie" - the same error I get if I don't include the mod in secure.trusted_mods

hyan
New member
Posts: 3
Joined: Sat Dec 15, 2018 13:31

Re: [Mod] Raspberry PI MC API for Python code [raspberryjamm

by hyan » Post

[Can't connect to server--SOLVED]
Hi, I am trying to apply this great mod to python programming education, and I think I would be fun with multi-player.
I have tested this mod on linux Ubuntu 18.04 with single-player and multi-player on the same machine.
But I have some problem with multi-player on different machines. I have a PC and a laptop both running Ubuntu 18.04 and both can run this mod in single-player mode.
Now I have PC as server and laptop as client, laptop can connect to server and play the game, but cannot use the mcpi api to connect to server.
If I enter the following in the laptop python ternimal:

Code: Select all

mc = Minecraft(connection=Connection("192.168.1.90",30000))    # try connecting to server
I get an error:

Code: Select all

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "connection.py", line 37, in __init__
    self.socket.connect((address, port))
  File "/usr/lib/python2.7/socket.py", line 228, in meth
    return getattr(self._sock,name)(*args)
socket.error: [Errno 111] Connection refused
Is there anything I have done wrong? Dose anyone successfully tried this mod on different machines playing multi-player?

Oh, forgot to mention, I using Minetest 0.4.16, lua5.1


----------------
[edit]:
now I have solved the above problem:

Code: Select all

mc = Minecraft(connection=Connection("192.168.1.90",30000)) 
# this is wrong way to connect to the api server, which is on a defferent port(default to 4711) than the minetest server
the right way is to set

Code: Select all

restrict_to_local_connections = false
in the settings.conf file(already set to false by default)
and do this on the client terminal:

Code: Select all

export MINECRAFT_API_HOST='your server address'
export MINECRAFT_PLAYER_NAME='your player name'
notice:
there are some differences between the links below, I don't know which is newer. my test is done with git cloning the 2nd link, and extracted the raspberryjammod folder. exporting MINECRAFT_PLAYER_NAME in ternimal might not be working with the source code in the 1st link.
https://github.com/arpruss/raspberryjam ... t/releases
https://github.com/arpruss/raspberryjammod-minetest

now It is fully functional even in multi-player mode on linux(ubuntu)! thanks again to the author!

zargulthewizard
Member
Posts: 230
Joined: Wed Jul 26, 2017 18:10
In-game: zargul

Re: [Mod] Raspberry PI MC API for Python code [raspberryjamm

by zargulthewizard » Post

rubenwardy wrote:
GRudolph wrote:@jocsamazon
I would like to know what specific changes you made in order to run minetest with raspberryjammod?
I am running Windows 10, Minetest 0.4.17.1 and Python 3.6.5.
I have replaced the mcpipy files as you indicated in your post quoted above, but the mod fails to load with the following error, and as a result, I cannot even test the Python scripts.
So how do I fix this error and proceed
add this to minetest.conf:

Code: Select all

secure.trusted_mods = raspberryjammod
cvincross wrote:have you added "secure.enable_security = true" to your minetest.conf? That is what fixed that error for me.
Don't touch this setting! Mod security should never be disabled

Still getting the le nil value error. Using 0.4.17
May God be with you, always.

hyan
New member
Posts: 3
Joined: Sat Dec 15, 2018 13:31

Re: [Mod] Raspberry PI MC API for Python code [raspberryjamm

by hyan » Post

zargulthewizard wrote:
rubenwardy wrote:
GRudolph wrote:@jocsamazon
I would like to know what specific changes you made in order to run minetest with raspberryjammod?
I am running Windows 10, Minetest 0.4.17.1 and Python 3.6.5.
I have replaced the mcpipy files as you indicated in your post quoted above, but the mod fails to load with the following error, and as a result, I cannot even test the Python scripts.
So how do I fix this error and proceed
add this to minetest.conf:

Code: Select all

secure.trusted_mods = raspberryjammod
cvincross wrote:have you added "secure.enable_security = true" to your minetest.conf? That is what fixed that error for me.
Don't touch this setting! Mod security should never be disabled

Still getting the le nil value error. Using 0.4.17
doesn't work for me either, so I just set security to false

zargulthewizard
Member
Posts: 230
Joined: Wed Jul 26, 2017 18:10
In-game: zargul

Re: [Mod] Raspberry PI MC API for Python code [raspberryjamm

by zargulthewizard » Post

That fixes it?
May God be with you, always.

hyan
New member
Posts: 3
Joined: Sat Dec 15, 2018 13:31

Re: [Mod] Raspberry PI MC API for Python code [raspberryjamm

by hyan » Post

zargulthewizard wrote:That fixes it?
yes

zargulthewizard
Member
Posts: 230
Joined: Wed Jul 26, 2017 18:10
In-game: zargul

Re: [Mod] Raspberry PI MC API for Python code [raspberryjamm

by zargulthewizard » Post

Well...
rubenwardy wrote: Don't touch this setting! Mod security should never be disabled
I don't really play online...
rubenwardy wrote: Mod security should never be disabled
Or use any really risky mods...
rubenwardy wrote: never be disabled
May God be with you, always.

zargulthewizard
Member
Posts: 230
Joined: Wed Jul 26, 2017 18:10
In-game: zargul

Re: [Mod] Raspberry PI MC API for Python code [raspberryjamm

by zargulthewizard » Post

I disabled it. The good news is the ie nil value error is gone. The bad news is during server creation Minetest crashed completely with no error report or anything.
May God be with you, always.

zicmama
Member
Posts: 17
Joined: Thu Jun 06, 2019 21:31
GitHub: zicmama

Re: [Mod] Raspberry PI MC API for Python code [raspberryjamm

by zicmama » Post

Anyone could explain how to install this mod on debian buster?
Thank you

acs
New member
Posts: 4
Joined: Tue May 05, 2020 02:52
GitHub: acs
IRC: acs
In-game: ElasticExplorer

Re: [Mod] Raspberry PI MC API for Python code [raspberryjamm

by acs » Post

zicmama wrote:
Mon Mar 02, 2020 00:48
Anyone could explain how to install this mod on debian buster?
Thank you
Just drop in ".minetest/mods" the folder https://github.com/arpruss/raspberryjam ... erryjammod

Then you need to activate it in your world mods config.

I have installed it in Fedora 32 and it is working nicely (at least the API that I have needed). I have needed to install the package "lua-socket-compat.x86_64" so this Lua 5.1 code runs in the 5.3 version that comes with Fedora 32. Good luck!

User avatar
JavierCantu
New member
Posts: 5
Joined: Fri Oct 30, 2020 23:48
GitHub: javier-cantu

Re: [Mod] Raspberry PI MC API for Python code [raspberryjamm

by JavierCantu » Post

acs wrote:
Tue May 05, 2020 02:59
zicmama wrote:
Mon Mar 02, 2020 00:48
Anyone could explain how to install this mod on debian buster?
Thank you
Just drop in ".minetest/mods" the folder https://github.com/arpruss/raspberryjam ... erryjammod

Then you need to activate it in your world mods config.

I have installed it in Fedora 32 and it is working nicely (at least the API that I have needed). I have needed to install the package "lua-socket-compat.x86_64" so this Lua 5.1 code runs in the 5.3 version that comes with Fedora 32. Good luck!
Bro I'm a complete noob, I can't understand how to install this and run Python scripts.
Can you guide me?

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests