Skip to content

Receiving "No methods for platform 'windows'!" on Windows 11 in scriptΒ #90

@Jackio007

Description

@Jackio007

Describe the bug
I receive a RuntimeWarning error when executing function through Python, but it's fine when running through the terminal.

Expected behavior
I am on a Windows platform, so Python should use the windows module, like it does from the terminal.

System info
(please complete the following information):

  • OS name (e.g. Windows 10 x64): Windows 11 x64
  • OS Version (e.g. 1804 build 17134): 22H2 22631.1835
  • Python version (e.g. CPython 3.6.5 x64): Python 3.9.13
  • getmac version (e.g. getmac 0.8.3): getmac 0.9.4

Additional context
When running get_mac_address(interface="WiFi") in Python, I get the following output:
C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\getmac\getmac.py:1441: RuntimeWarning: No methods for platform 'windows'! Your system may not be supported. Falling back to platform 'other'.
warnings.warn(warn_msg, RuntimeWarning)

04:6c:59:0f:10:40

However, when running via the terminal I get the following, confirming platform is windows:

python -m getmac -v -d
DEBUG Initializing 'ip4' method cache (platform: 'windows')
DEBUG Current method cache: {'ip4': 'CtypesHost', 'ip6': 'None', 'iface': 'None', 'default_iface': 'None'}
DEBUG Current fallback cache: {'ip4': '[<getmac.getmac.ArpExe object at 0x0000029C0C921D90>]', 'ip6': '[]', 'iface': '[]', 'default_iface': '[]'}
DEBUG Finished initializing 'ip4' method cache
DEBUG Attempting get() (method='CtypesHost', method_type='ip4', arg='192.168.0.136')
DEBUG Raw MAC found: 046c590f1040
DEBUG getmac took 0.0028 seconds
DEBUG Adding colons to MAC 046c590f1040

(This is my first ever issue, so apologies if there is anything missed)

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions