Python,未使用cxfreeze定义日志模块

Python,未使用cxfreeze定义日志模块,python,logging,module,undefined,Python,Logging,Module,Undefined,我想第一次使用CxFreeze。我还想实现日志模块,它是Python 3.6中的标准模块。 我有最新版本的CxFreeze安装(在5.1.1中) 这是我的密码 from cx_Freeze import setup, Executable import os,sys, logging base = None executables = [Executable("utt.py", base=base)] packages = ["idna"] includes = ["logging"] o

我想第一次使用CxFreeze。我还想实现日志模块,它是Python 3.6中的标准模块。 我有最新版本的CxFreeze安装(在5.1.1中)

这是我的密码

from cx_Freeze import setup, Executable
import os,sys, logging

base = None
executables = [Executable("utt.py", base=base)]

packages = ["idna"]
includes = ["logging"]

options = {
    'build_exe': {
        'packages':packages,
        'includes':includes
    },
}

# On appelle la fonction setup
setup(
    name = "Import ",
    version = "1",
    description = "Gestion rapide",
    options = options,
    executables = executables
)
这里是错误信息

C:\Python\Python36\Scripts>C:\Python\Python36\Scripts\build\exe.win-amd64-3.6\utt.exe
2018-08-21 17:43:46.354712
2018-08-21-17-43-46
Traceback (most recent call last):
  File "C:\Python\Python36\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 14, in run
    module.run()
  File "C:\Python\Python36\lib\site-packages\cx_Freeze\initscripts\Console.py", line 26, in run
    exec(code, m.__dict__)
  File "utt.py", line 16, in <module>
    logging.basicConfig(filename=fileDate,level=logging.DEBUG,format='%(asctime)s %(levelname)s-8s %(message)s')
NameError: name 'logging' is not defined
C:\Python\Python36\Scripts>C:\Python\Python36\Scripts\build\exe.win-amd64-3.6\utt.exe
2018-08-21 17:43:46.354712
2018-08-21-17-43-46
回溯(最近一次呼叫最后一次):
文件“C:\Python\Python36\lib\site packages\cx\u Freeze\initscripts\uuuuuu startup\uuuuu.py”,第14行,正在运行
module.run()
文件“C:\Python\Python36\lib\site packages\cx\u Freeze\initscripts\Console.py”,第26行,正在运行
执行官(代码、指令)
文件“utt.py”,第16行,在
logging.basicConfig(filename=fileDate,level=logging.DEBUG,格式='%(asctime)s%(levelname)s-8s%(message)s')
NameError:未定义名称“日志记录”
拜托,我不明白为什么我的名字没有定义。我尝试了include和Packages属性,甚至使用include\u files属性导入日志库


问候。

事实上,这不是CXFreeze错误。我在安装安装程序的过程中犯了一个错误。我将导入命令移动到另一个.py文件(其中包含代码的配置参数)。我误用了import命令,认为嵌套导入更简单

我应该在没有cxfreeze的情况下测试我的构建以进行此修改


谢谢您的评论,是您导致了我的错误。

您的脚本在不在可执行文件中时运行吗?这是一个python错误,不是cxfreeze错误。请向我们展示
utt.py
。或者,更好的方法是,向我们展示一个,只有足够的代码来重现问题,而没有其他内容。可能是您忘记在
utt.py
中导入
logging
?另外,我认为您不应该在
包含的
中指定
日志记录
,因为它是一个标准模块,总是隐式包含。