Dmytro Boiko <code_warr...@ukr.net> writes:

> When i start my elinks i see next message:

[...]

>    File "/usr/lib/python2.7/site.py", line 228, in getuserbase
>      from sysconfig import get_config_var
> ImportWarning: Not importing directory '/etc/sysconfig': missing __init__.py

I suppose this happens because:

* openSUSE configures ELinks with --sysconfdir=/etc
  
<https://build.opensuse.org/package/rawlog?arch=i586&package=elinks&project=openSUSE%3A11.4%3AContrib&repository=standard>.
  Because sysconfdir is explicitly set, the configure script of
  ELinks does not append "/elinks" to it.  Thus, config.h
  ends up defining CONFDIR as "/etc".
* When ELinks is starting up, init_python() calls
  PySys_AddWarnOption("error"), which makes Python behave as if
  python -Werror had been used: all warnings raise exceptions.
  Even ImportWarning, which Python normally ignores.
* When ELinks is starting up, set_python_search_path() adds
  CONFDIR (i.e. "/etc") to the PYTHONPATH environment variable.
* openSUSE has an /etc/sysconfig directory.
* When /usr/lib/python2.7/site.py does "from sysconfig import
  get_config_var", Python first looks in the /etc/sysconfig
  directory, because /etc is the first item in PYTHONPATH.
  /etc/sysconfig however was never intended for Python and
  doesn't contain an __init__.py file.  Python warns about that.
  This ImportWarning would normally be ignored but now becomes
  an exception because ELinks did PySys_AddWarnOption("error").

openSUSE really should change its elinks package to set
--sysconfdir=/etc/elinks.  The current setting makes ELinks also
try to load /etc/hooks.rb and /etc/hooks.pl (as can be seen from
/usr/bin/elinks in elinks-0.11.995-1.1.x86_64.rpm of openSUSE).
Those file names are too generic for /etc.

I'm not sure why ELinks calls PySys_AddWarnOption("error").
Perhaps it is because just writing the warnings to stderr would
mess up the display.  If so, ELinks should instead hook
warnings.showwarning so that execution will continue after the
warning.  Perhaps collect all warnings to a list and then show
the list in a dialog after the Python call has returned.
_______________________________________________
elinks-users mailing list
elinks-users@linuxfromscratch.org
http://linuxfromscratch.org/mailman/listinfo/elinks-users

Reply via email to