The Mud Connector

Author Topic: Nakedmud startup error  (Read 689 times)

sprockfizzly

  • New to TMC
  • *
  • Posts: 8
    • View Profile
Nakedmud startup error
« on: February 20, 2018, 8:24 PM »
Lo all. Decided to try to mess with NakedMud. After a while i got it to compile, but when i run it i get this in the log. Dont know Python. Its the reason i wanted to mess around with it. But here is the log:


Feb 19 23:43:28: Error loading module, char_gen:

Traceback (most recent call last):
  File "../lib/pymodules/char_gen.py", line 7, in <module>
    import mudsys, mud, socket, char, hooks
  File "/usr/lib/python2.7/socket.py", line 47, in <module>
    import _socket
SystemError: _PyImport_FixupExtension: module _socket not loaded


Feb 19 23:43:28: Bootup aborted. MUD shutting down.

I looked at both the files it references but didnt see anything off. I am using Python2.7 which is newer than the version NakedMud was done in. Anyone got any ideas? Thanks for any help.

Grogslinger

  • New to TMC
  • *
  • Posts: 16
    • View Profile
Re: Nakedmud startup error
« Reply #1 on: February 20, 2018, 8:54 PM »
I don't know Nakedmud, but I do know Python.

What O/S are you running?  I believe most linux distros and recent MacOS already have 2.7 installed.  Windows, however, requires you to download the install the package.  You should not have to technically run any sort of build when doing a windows install, so long as you download the precompiled version and just let Python install do its magic.

Edit: I am assuming NakedMud built without error for you... :-)

_socket is an extension module - basically interfaces with either .so or .dll (o/s dependent) that may need built, depending on how you've installed Python.  On windows, if you look in the ../python2.7/Dlls folder, you should see _socket.pyd and several DLLs.

If all the above exists, it's possible you've gotten something misconfigured with environment variables or some other configuration parameter within nakedmud.





« Last Edit: February 20, 2018, 9:02 PM by Grogslinger »

sprockfizzly

  • New to TMC
  • *
  • Posts: 8
    • View Profile
Re: Nakedmud startup error
« Reply #2 on: February 20, 2018, 9:00 PM »
Hi. Im using Linux raspberrypi 4.9.35-v7+. Forgot to mention im doing this on a Pi. Starting to think its a lost cause. to get it to compile i had to add all this to the make process:

LIBS     += -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions -lm -ldl -lutil -L/usr/lib/python2.7/config-arm-linux-gnueabihf -lpython2.7

Grogslinger

  • New to TMC
  • *
  • Posts: 16
    • View Profile
Re: Nakedmud startup error
« Reply #3 on: February 20, 2018, 9:11 PM »
Oh! Interesting. I've never tried python on one of those units.  Is python actually functional?  If it is properly installed, you should be able to type: python -v which will report the version installed.

I suppose, if you built it yourself, you may not have built it with socket support.  A quick check to verify would be to create a new .py file with a single line:
import socket

Then, execute the file with: python [whatever-you-named-the-file].py

If you get the same error above, I'd say your python build failed to include the socket library....(or, something is misconfigured).


sprockfizzly

  • New to TMC
  • *
  • Posts: 8
    • View Profile
Re: Nakedmud startup error
« Reply #4 on: February 20, 2018, 9:22 PM »
I got it from walmart ironically. came with everything except mouse, keyboard, and monitor. linux was pre-installed with a bunch of programming tools. Heres my Python version

Python 2.7.9 (default, Sep 17 2016, 20:26:04)
[GCC 4.9.2] on linux2

and the import socket test didnt report any errors, just went to a new line.

Grogslinger

  • New to TMC
  • *
  • Posts: 16
    • View Profile
Re: Nakedmud startup error
« Reply #5 on: February 20, 2018, 9:50 PM »
Considering your version of Python appears to be properly set up, it should be good to go to be embedded...  Sorry, at this point I'd be shooting in the dark.

sprockfizzly

  • New to TMC
  • *
  • Posts: 8
    • View Profile
Re: Nakedmud startup error
« Reply #6 on: February 20, 2018, 9:51 PM »
well thanks for the help. guess ill keep googleing. thanks again :)

Grogslinger

  • New to TMC
  • *
  • Posts: 16
    • View Profile
Re: Nakedmud startup error
« Reply #7 on: February 20, 2018, 9:59 PM »
On a side note (and you may have already looked here), the Python website offers some assistance and info you may be able to use to ensure everything is getting embedded and exposed properly:

https://docs.python.org/2.7/extending/embedding.html

Section 5.6 ...

Best of luck!


Grogslinger

  • New to TMC
  • *
  • Posts: 16
    • View Profile
Re: Nakedmud startup error
« Reply #8 on: February 20, 2018, 10:10 PM »
Another quick note --  for shits and giggles, I downloaded NakedMud and took a peek at the particular .py file throwing the error.

From all intents and purposes, it looks like you could remove the socket import.
modify /lib/pymodules/char_gen.py

import mudsys, mud, socket, char, hooks
would become
import mudsys, mud,  char, hooks

It appears to be an unused import.  Worst case scenario, it fails harder and you have to add it back. :-)

Edit: After looking through more code, the above is not really going to work, as there are many other .py files importing python modules. (socket, telnetlib, etc).  I have to go back, then, to the idea that the other dependencies (ie socket.dll/so) are not properly being exported/linked to.


« Last Edit: February 20, 2018, 10:20 PM by Grogslinger »

sprockfizzly

  • New to TMC
  • *
  • Posts: 8
    • View Profile
Re: Nakedmud startup error
« Reply #9 on: February 20, 2018, 10:20 PM »
heh. took it out now its a different one.

Traceback (most recent call last):
  File "../lib/pymodules/account_handler.py", line 7, in <module>
    import mud, mudsys, char, hooks, account, socket, event, telnetlib, utils
  File "/usr/lib/python2.7/socket.py", line 47, in <module>
    import _socket
SystemError: _PyImport_FixupExtension: module _socket not loaded

Grogslinger

  • New to TMC
  • *
  • Posts: 16
    • View Profile
Re: Nakedmud startup error
« Reply #10 on: February 20, 2018, 10:22 PM »
Yeah, I just edited my previous post.  It appears that your NakedMud build is not fully embedding everything python depends on - for example, the socket module.

As long the socket module is not actually being used, you could remove it everywhere it is imported.  From the looks of things, you're able to access other parts of the standard library (like telnetlib ).  I think it would be better to figure out how to get the socket.so properly exported/linked to.

Edit Again: Doing  a quick search-in-files for the use of the socket module in the python code, it appears you're actually safe to remove it from all import statements in the various .py files.  Please note I did a quick, cursory review.. :-)
« Last Edit: February 20, 2018, 10:32 PM by Grogslinger »

sprockfizzly

  • New to TMC
  • *
  • Posts: 8
    • View Profile
Re: Nakedmud startup error
« Reply #11 on: February 20, 2018, 10:44 PM »
thinking maybe i dont have the correct python runtime library. been going through the list of them i found with 'find'

sprockfizzly

  • New to TMC
  • *
  • Posts: 8
    • View Profile
Re: Nakedmud startup error
« Reply #12 on: February 20, 2018, 10:58 PM »
bah. i give up for the night. the mud imports socket but the python file imports _socket. im done for today lol

Grogslinger

  • New to TMC
  • *
  • Posts: 16
    • View Profile
Re: Nakedmud startup error
« Reply #13 on: February 20, 2018, 11:04 PM »
When I said it looks to be safe to remove socket imports from the .py files, I was referring to the py files distributed with NakedMud - I really hope that was implied.  Don't modify Python's standard library... :-)

But, I do believe you really need to get to the root cause of the problem -- and that seems to be that socket.so is not being appropriately exported/linked into your NakedMud build. After-all, you may want to use socket some day, down the road (or use a standard python module that relies on it)

sprockfizzly

  • New to TMC
  • *
  • Posts: 8
    • View Profile
Re: Nakedmud startup error
« Reply #14 on: February 20, 2018, 11:10 PM »
hmm. tomorrow i might try a older version of NakedMud. or maybe switch to socketmud. sigh