building seamonkey - python setup - imp module

Nils Breunese breun at macports.org
Tue Sep 10 20:19:08 UTC 2024


Python's imp module was deprecated in Python 3.4 in favor of ‘importlib’, and removed in Python 3.12.

This is confirmed by the deprecation warning printed by Python 3.11, which does still have the imp module:

❯ /opt/local/bin/python3.11
Python 3.11.10 (main, Sep  7 2024, 05:47:53) [Clang 15.0.0 (clang-1500.1.0.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import imp
<stdin>:1: DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses

But it is indeed no longer present in Python 3.12:

❯ /opt/local/bin/python3.12        Python 3.12.6 (main, Sep  7 2024, 05:15:33) [Clang 15.0.0 (clang-1500.1.0.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import imp
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named ‘imp'

I guess you’ll either need to use an older Python version, or patch SeaMonkey to use the importlib module instead.

Nils.

Riccardo Mottola via macports-users <macports-users at lists.macports.org> wrote:

> Hi,
> 
> I would like to try to build SeaMonkey on 10.9 Mavericks. A decent browser and a good email client. Officially not supported on 10.9, but it works on 10.11, so I have some hope it can be convinced to run. Maybe some of you want to help?
> 
> Biggest issue is getting it to run. Latest version requires python3 and also somehow wants an internal python?
> 
> $ MACH_USE_SYSTEM_PYTHON=1 ./mach build
> 
> should convince it to use system python, which should be python3, so almost easier as the legacy python2.7 for ArcticFox and similar.
> 
> I did use python select and so now I have:
> 
> $ python3 --version
> Python 3.12.6
> 
> but when I run I get:
> /Users/multix/code/seamonkey-2.53.19/./mach:12: SyntaxWarning: invalid escape sequence '\ '
>  ''':'
> Traceback (most recent call last):
>  File "/Users/multix/code/seamonkey-2.53.19/./mach", line 270, in <module>
>    main(sys.argv[1:])
>  File "/Users/multix/code/seamonkey-2.53.19/./mach", line 262, in main
>    mach = get_mach()
>           ^^^^^^^^^^
>  File "/Users/multix/code/seamonkey-2.53.19/./mach", line 252, in get_mach
>    mach = check_and_get_mach(dir_path)
>           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>  File "/Users/multix/code/seamonkey-2.53.19/./mach", line 208, in check_and_get_mach
>    return load_mach(dir_path, mach_path)
>           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>  File "/Users/multix/code/seamonkey-2.53.19/./mach", line 196, in load_mach
>    return mach_bootstrap.bootstrap(dir_path)
>           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>  File "/Users/multix/code/seamonkey-2.53.19/build/mach_bootstrap.py", line 189, in bootstrap
>    import mach.main
>  File "/Users/multix/code/seamonkey-2.53.19/python/mach/mach/main.py", line 13, in <module>
>    import imp
> ModuleNotFoundError: No module named 'imp'
> 
> I understand it is not finding module “imp”. I wonder if my python 3.12 misses some module to isntall? any python expert here?
> 
> Riccardo
> 
> -- 
> Sent with GNUMail on MacBook Pro running Mavericks
> 



More information about the macports-users mailing list