Discussion:
[Twisted-Python] error on log module (twisted python 3)
Gelin Yan
2015-09-08 06:48:52 UTC
Permalink
Hi All

I just noticed my app raised an exception such as

Traceback (most recent call last):

File "/home/m/py343/lib/python3.4/runpy.py", line 170, in
_run_module_as_main

"__main__", mod_spec)

File "/home/m/py343/lib/python3.4/runpy.py", line 85, in _run_code

exec(code, run_globals)

File "gw_go.zip/__main__.py", line 8, in <module>

File "gw_go.zip/gw_server2/gw_go.py", line 87, in main

File
"/home/m/py343/lib/python3.4/site-packages/twisted/python/logfile.py", line
48, in fromFullPath

os.path.dirname(logPath), *args, **kwargs)

File
"/home/m/py343/lib/python3.4/site-packages/twisted/python/logfile.py", line
40, in __init__

self._openFile()

File
"/home/m/py343/lib/python3.4/site-packages/twisted/python/logfile.py", line
238, in _openFile

BaseLogFile._openFile(self)

File
"/home/m/py343/lib/python3.4/site-packages/twisted/python/logfile.py", line
75, in _openFile

self._file = file(self.path, "w+", 1)

NameError: name 'file' is not defined


I used python 3.4 and twisted 15.40 (from pip) under ubuntu 14.04.


Regards


gelin yan
Glyph
2015-09-08 07:16:45 UTC
Permalink
Post by Gelin Yan
Hi All
I just noticed my app raised an exception such as
File "/home/m/py343/lib/python3.4/runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "/home/m/py343/lib/python3.4/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "gw_go.zip/__main__.py", line 8, in <module>
File "gw_go.zip/gw_server2/gw_go.py", line 87, in main
File "/home/m/py343/lib/python3.4/site-packages/twisted/python/logfile.py", line 48, in fromFullPath
os.path.dirname(logPath), *args, **kwargs)
File "/home/m/py343/lib/python3.4/site-packages/twisted/python/logfile.py", line 40, in __init__
self._openFile()
File "/home/m/py343/lib/python3.4/site-packages/twisted/python/logfile.py", line 238, in _openFile
BaseLogFile._openFile(self)
File "/home/m/py343/lib/python3.4/site-packages/twisted/python/logfile.py", line 75, in _openFile
self._file = file(self.path, "w+", 1)
NameError: name 'file' is not defined
I used python 3.4 and twisted 15.40 (from pip) under ubuntu 14.04.
twisted.python.logfile was not fully ported as of Twisted 15.4; just the syntax. So this error is expected. However, you may be pleased to hear that the fix landed last week: https://twistedmatrix.com/trac/ticket/6749 <https://twistedmatrix.com/trac/ticket/6749> and will be in 15.5.

-glyph
Gelin Yan
2015-09-08 07:57:27 UTC
Permalink
Post by Gelin Yan
Hi All
I just noticed my app raised an exception such as
File "/home/m/py343/lib/python3.4/runpy.py", line 170, in
_run_module_as_main
"__main__", mod_spec)
File "/home/m/py343/lib/python3.4/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "gw_go.zip/__main__.py", line 8, in <module>
File "gw_go.zip/gw_server2/gw_go.py", line 87, in main
File
"/home/m/py343/lib/python3.4/site-packages/twisted/python/logfile.py", line
48, in fromFullPath
os.path.dirname(logPath), *args, **kwargs)
File
"/home/m/py343/lib/python3.4/site-packages/twisted/python/logfile.py", line
40, in __init__
self._openFile()
File
"/home/m/py343/lib/python3.4/site-packages/twisted/python/logfile.py", line
238, in _openFile
BaseLogFile._openFile(self)
File
"/home/m/py343/lib/python3.4/site-packages/twisted/python/logfile.py", line
75, in _openFile
self._file = file(self.path, "w+", 1)
NameError: name 'file' is not defined
I used python 3.4 and twisted 15.40 (from pip) under ubuntu 14.04.
twisted.python.logfile was not fully ported as of Twisted 15.4; just the
syntax. So this error is expected. However, you may be pleased to hear
that the fix landed last week: https://twistedmatrix.com/trac/ticket/6749 and
will be in 15.5.
-glyph
_______________________________________________
Twisted-Python mailing list
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
Hi Glyph

I just found out the ticket you mentioned. It looks like 15.4 doesn't
include it. I am waiting for the next release. For now, I have to use the
standard logging system.

Regards

gelin yan

Loading...