草庐IT

Application-Name

全部标签

python - imp.reload - NoneType 对象没有属性 'name'

以下代码:def_IMPORT_(path)path=abspath(path)namespace=path[len(getcwd())+1:].replace('/','_').strip('\\/;,.')print(path)print(namespace)loader=importlib.machinery.SourceFileLoader(namespace,path+'.py')handle=loader.load_module(namespace)print(handle)importlib.reload(handle)returnhandle产生:/home/torxe

python - 为什么在第二次导入时导入错误变为 "cannot import name"?

这是一个神秘的python问题:我正在开发一个python包,偶尔会报告类似ImportError:cannotimportname...的导入错误。一般不能导入的模块是可进口的没有任何循环导入问题(我可以检测到)。我已经能够用这个简单的例子重现类似的效果:mypkg/__init__.py:from.importmodule_ayarg##causeimporterrormypkg/module_a.py:print"importedmodule_a"现在我将尝试导入包两次。请注意,第二次导入时错误发生了变化:>>>importmypkgModuleAimportedTracebac

python - 用户警告 : Pandas doesn't allow columns to be created via a new attribute name

我受困于我的pandas脚本。实际上,我正在处理两个csv文件(一个输入文件和另一个输出文件)。我想复制两列的所有行并进行计算,然后将其复制到另一个数据框(输出文件)。列如下:'lat','long','PHCount','latOffset_1','longOffset_1','PH_Lat_1','PH_Long_1','latOffset_2','longOffset_2','PH_Lat_2','PH_Long_2','latOffset_3','longOffset_3','PH_Lat_3','PH_Long_3','latOffset_4','longOffset_4',

python - 为什么 cls.__name__ 没有出现在 dir() 中?

假设我有一个简单的类:classFoobar(object):pass如果我使用dir(Foobar),我将得到以下输出:['__class__','__delattr__','__dict__','__doc__','__format__','__getattribute__','__hash__','__init__','__module__','__new__','__reduce__','__reduce_ex__','__repr__','__setattr__','__sizeof__','__str__','__subclasshook__','__weakref__']

python - 输入(): "NameError: name ' n' is not defined"

这个问题在这里已经有了答案:input()error-NameError:name'...'isnotdefined(15个答案)关闭6年前。好的,所以我正在用python编写成绩检查代码,我的代码是:unit3Done=str(input("HaveyoudoneyourUnit3ControlledAssessment?(Typeyorn):")).lower()ifunit3Done=="y":passelifunit3Done=="n":print"Sorry.YoumusthavedoneatleastoneunittocalculatewhatyouneedforanA*"

python - Selenium python find_element_by_class_name() 从 v 2.2 到 2.21 停止工作——不能使用 'Compound Class Name'

我正在使用Selenium的python库从Firefox的html页面中抓取数据。我不得不从Selenium2.0更新到2.21,因为服务器已经更新了Firefox。在v2.21中调用find_element_by_class_name("grid-cell-innergrid-col-name")失败:selenium.common.exceptions.WebDriverException:Message:u'Compoundclassnamesnotpermitted'我尝试访问的元素的类名是grid-cell-innergrid-col-name对find_element_b

android - 运行时异常 : Unable to instantiate application

当我运行我的应用程序时,每次我的logcat中都会出现以下异常:04-1409:29:53.965:W/dalvikvm(1020):threadid=1:threadexitingwithuncaughtexception(group=0x409c01f8)04-1409:29:53.985:E/AndroidRuntime(1020):FATALEXCEPTION:main04-1409:29:53.985:E/AndroidRuntime(1020):java.lang.RuntimeException:Unabletoinstantiateapplicationandroid.

android - 运行时异常 : Unable to instantiate application

当我运行我的应用程序时,每次我的logcat中都会出现以下异常:04-1409:29:53.965:W/dalvikvm(1020):threadid=1:threadexitingwithuncaughtexception(group=0x409c01f8)04-1409:29:53.985:E/AndroidRuntime(1020):FATALEXCEPTION:main04-1409:29:53.985:E/AndroidRuntime(1020):java.lang.RuntimeException:Unabletoinstantiateapplicationandroid.

python - jupyter 抛出错误 : socket. gaierror: [Errno -2] Name or service not known

我在AWSEMR上运行一个pyspark集群,并将Jupyter用于pyspark驱动程序。最近,脚本失败了。Jupiter无法启动服务器。我使用condainstalljupyter安装并使用sudoinitctlstartjupyter启动。集群运行良好。这是服务器的配置值。#jupyterconfigsmkdir-p~/.jupytertouchls~/.jupyter/jupyter_notebook_config.pyHASHED_PASSWORD=$(python-c"fromnotebook.authimportpasswd;print(passwd('$JUPYTER_

python - Satchmo 克隆satchmo.py ImportError : cannot import name execute_manager

我让satchmo尝试,但我在第一次尝试时遇到了一个很大的问题,我不明白哪里出了问题。当我将$pythonclonesatchmo.py制作成清晰的django项目时,它会报错:$pythonclonesatchmo.pyCreatingtheSatchmoApplicationCustomizingthefilesPerforminginitialdatasynchingTraceback(mostrecentcalllast):File"manage.py",line18,infromdjango.core.managementimportexecute_managerImport