Page 1 of 1

[solved] Loading plugin fails (built-in module name)

Posted: Sat Jun 15, 2019 10:13 pm
by BackRaw
Hi,

I just setup my test server and I'm trying to load my udm plugin via

Code: Select all

sp plugin reload udm
from the server's console. It works for CS:S, but for CS:GO it says

Code: Select all

[SP] Cannot load plugin 'udm'. Plugin name cannot be name of a built-in module

Am I doing something wrong or is there actually a module named udm? I don't think so, because it works for CS:S.

Output of sp info:

Code: Select all

sp info

IMPORTANT: Please copy the full output.
--------------------------------------------------------
Checksum      : 2961f20500a1df080ae90ebff179314a
Date          : 2019-06-15 22:36:14.352539
OS            : Windows-7-6.1.7601-SP1
Game          : csgo
SP version    : 690
Github commit : c0e62fa54616e5242f0108cd16a8f2b201fd0b2a
Server plugins:
   00: Source.Python, (C) 2012-2019, Source.Python Team.
SP plugins:
--------------------------------------------------------



Thank you!

Re: Loading plugin fails (built-in module name)

Posted: Sun Jun 16, 2019 2:24 am
by L'In20Cible
You must have an ../udm/udm.py file into a search paths (../Python3/, ../packages/custom/, ../packages/site-packages/, etc.) that is imported before it is found as a plugin and is considered a built-in module.

Re: Loading plugin fails (built-in module name)

Posted: Sun Jun 16, 2019 5:40 pm
by BackRaw
Is there a quick way to find that out?

Re: Loading plugin fails (built-in module name)

Posted: Sun Jun 16, 2019 6:44 pm
by Ayuto
Either look through those directories or load this plugin:

Syntax: Select all

import udm

print(udm.__file__)

Re: Loading plugin fails (built-in module name)

Posted: Mon Jun 17, 2019 11:30 am
by BackRaw
Thanks I'll try that.

Re: Loading plugin fails (built-in module name)

Posted: Thu Jun 20, 2019 7:23 pm
by BackRaw
Okay so I have created a plugin test with the following content:

Syntax: Select all

# ../addons/source-python/plugins/test/test.py

import udm

print(udm.__file__)
The output:

Code: Select all

sp plugin reload test
[SP] Unloading plugin 'test'...
[SP] Successfully unloaded plugin 'test'.
[SP] Loading plugin 'test'...
Z:\srcds\Windows\csgo\csgo\addons\source-python\plugins\udm\__init__.py
[SP] Successfully loaded plugin 'test'.

Everything seems fine, there's nothing called udm before my plugin. But the built-in module error still occurs after loading up udm.

Just to clarify, Z: is a network share. Is that maybe causing the error? But then again, why does it work for CS:S?

Edit: manually searching for 'udm' from inside my server directory Z:\srcds\Windows\csgo it only shows my plugin's files and nothing more.

Re: Loading plugin fails (built-in module name)

Posted: Thu Jun 20, 2019 8:24 pm
by satoon101
That message will be printed if the following conditional is met:
https://github.com/Source-Python-Dev-Te ... er.py#L181

Add some debug messages in there before the 'raise' statement to see what the values of 'spec', 'spec.origin' (if spec is not None), and 'plugin.file_path' are.

Re: Loading plugin fails (built-in module name)

Posted: Tue Jun 25, 2019 5:35 pm
by BackRaw
I've added

Syntax: Select all

print(f'\n\nspec: {spec}\n\nplugin.file_path: {plugin.file_path}\n\n')
to line 182 in plugins/manager.py and the output is:

Code: Select all

[SP] Unloading plugin 'udm'...
[SP] Unable to unload plugin 'udm' as it is not currently loaded.
[SP] Loading plugin 'udm'...

spec: ModuleSpec(name='udm.udm', loader=<_frozen_importlib_external.SourceFileLoader object at 0x1955B210>, origin='Z:\\srcds\\Windows\\csgo\\csgo\\addons\\source-python\\plugins\\udm\\udm\\__init__.py', submodule_search_locations=['Z:\\srcds\\Windows\\csgo\\csgo\\addons\\source-python\\plugins\\udm\\udm'])

plugin.file_path: Z:\srcds\Windows\csgo\csgo\addons\source-python\plugins\udm\udm.py

[SP] Cannot load plugin 'udm'. Plugin name cannot be name of a built-in module

Oh my God, wait a second...

Edit: No wonder, I had a folder udm inside my udm folder which had another udm folder inside it. What the hell was that lol... Anyway I messed up my symlinking. I'll try to recover it now.

Edit 2: Works now. Never stay up too long and try to symlink your way through I guess... Thanks for the help!!