[issue29206] importlib reload fails for module supplied as argument to command line

2017-01-08 Thread John Lehmann

John Lehmann added the comment:

I may not have been clear as to how the problem seems when working with a 
web.py application:

* visit the web page, see something that needs fixing
* make the required change to app.py
* reload the webpage
* error occurs

--

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29206>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29206] importlib reload fails for module supplied as argument to command line

2017-01-08 Thread John Lehmann

New submission from John Lehmann:

In testing the py3 port for the web framework web.py, I found a limitation of 
importlib.reload.

A module that was loaded via the command line cannot be reloaded with 
importlib.reload.

The basic mode of operation for web.py is to create a web application as a 
single module, say, "app.py" and run this with "python app.py".

When in development mode, on each page view, the modification time for each 
file backing each module is checked for changes.  If the file has changed, the 
file is reloaded.

This allows for an iterative development mode familiar to web developers since 
the glory days of writing VB pages in ASP.

The problem occurs when the file is loaded directly, or with "-m".

For example with the attached file:

  $ python reloader.py
  Traceback (most recent call last):
File "reloader.py", line 31, in 
  reload_module("__main__")
File "reloader.py", line 28, in reload_module
  importlib.reload(module)
File 
"/usr/local/var/pyenv/versions/3.5.2/lib/python3.5/importlib/__init__.py", line 
166, in reload
  _bootstrap._exec(spec, module)
File "", line 607, in _exec
  AttributeError: 'NoneType' object has no attribute 'name'

And with -m:

  $ python -m reloader
  Traceback (most recent call last):
File "/usr/local/var/pyenv/versions/3.5.2/lib/python3.5/runpy.py", line 
184, in _run_module_as_main
  "__main__", mod_spec)
File "/usr/local/var/pyenv/versions/3.5.2/lib/python3.5/runpy.py", line 85, 
in _run_code
  exec(code, run_globals)
File "reloader.py", line 31, in 
  reload_module("__main__")
File "reloader.py", line 28, in reload_module
  importlib.reload(module)
File 
"/usr/local/var/pyenv/versions/3.5.2/lib/python3.5/importlib/__init__.py", line 
147, in reload
  raise ImportError(msg.format(name), name=name)
  ImportError: module reloader not in sys.modules

Note that there are two different error messages, neither of which is great.

There are workarounds, but given that this works in previous version of python, 
it might be better to fix it.  Or to have an explicit error message that 
describes the problem more precisely:

  "Cannot reload __main__"

--
files: reloader.py
messages: 284982
nosy: brett.cannon, j1o1h1n, r.david.murray
priority: normal
severity: normal
status: open
title: importlib reload fails for module supplied as argument to command line
type: behavior
versions: Python 3.5
Added file: http://bugs.python.org/file46212/reloader.py

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29206>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29194] importlib reload fails for module supplied as argument to command line

2017-01-08 Thread John Lehmann

John Lehmann added the comment:

You get a slightly different error using "-m".

I'll raise a new defect - with some background that may make the bug seem more 
reasonable.

--

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29194>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29194] importlib reload fails for module supplied as argument to command line

2017-01-07 Thread John Lehmann

New submission from John Lehmann:

Modules that have been loaded as an argument to the command line cannot be 
reloaded using importlib.reload.

For example with the attached file:

  $ python reloader.py
  Traceback (most recent call last):
File "reloader.py", line 31, in 
  reload_module("__main__")
File "reloader.py", line 28, in reload_module
  importlib.reload(module)
File 
"/usr/local/var/pyenv/versions/3.5.2/lib/python3.5/importlib/__init__.py", line 
166, in reload
  _bootstrap._exec(spec, module)
File "", line 607, in _exec
  AttributeError: 'NoneType' object has no attribute 'name'

--
components: Library (Lib)
files: reloader.py
messages: 284910
nosy: j1o1h1n
priority: normal
severity: normal
status: open
title: importlib reload fails for module supplied as argument to command line
versions: Python 3.5
Added file: http://bugs.python.org/file46191/reloader.py

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29194>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23972] Asyncio reuseport

2015-08-18 Thread John Lehmann

Changes by John Lehmann j1o1...@gmail.com:


--
nosy: +j1o1h1n

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23972
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com