将__file__加上单引号就解决了:

  1.  
    # 获取当前文件名,用于创建模型及结果文件的目录
  2.  
    file_name = os.path.basename('__file__').split('.')[0]

参考网址:https://blog.csdn.net/m0_37544464/article/details/82906459

多线程启动selenium,报NameError: name '__file__' is not defined的更多相关文章

  1. selenium之多线程启动grid分布式测试框架封装(四)

    九.工具类,启动所有远程服务的浏览器 在utils包中创建java类:LaunchAllRemoteBrowsers package com.lingfeng.utils; import java.n ...

  2. 【Selenium】【BugList11】启动selenium server报错:Unsupported major.minor version 52.0

    [环境信息] python:3.6.5 平台:win7 selenium:3.11.0 selenium server:selenium-server-standalone-3.11.0.jar jd ...

  3. py+selenium 报错NameError: name 'NoSuchElementException' is not defined【已解决】

     报错:NameError: name 'NoSuchElementException' is not defined  如图 解决方法: 头部加一句:from selenium.common.exc ...

  4. python脚本中selenium启动浏览器报错os.path.basename(self.path), self.start_error_message) selenium.common.excep

    在python脚本中,使用selenium启动浏览器报错,原因是未安装浏览器驱动,报错内容如下: # -*- coding:utf-8 -*-from selenium import webdrive ...

  5. Firefox37.0.1+selenium 2.53+python3.6打开浏览器时报错NameError: name 'basestring' is not defined

    环境:Win7      Firefox浏览器版本37.0.1      Python36      Selenium2.53.0 在Pycharm里执行以下3行脚本: from selenium i ...

  6. 解决centos7下 selenium报错--unknown error: DevToolsActivePort file doesn't exist

    解决centos7下 selenium报错--unknown error: DevToolsActivePort file doesn't exist 早上在linux下用selenium启动Chro ...

  7. maven 项目启动tomcat报错 java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

    maven项目启动tomcat报错: java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderLi ...

  8. 【转】Eclipse下启动tomcat报错:/bin/bootstrap.jar which is referenced by the classpath, does not exist.

    转载地址:http://blog.csdn.net/jnqqls/article/details/8946964 1.错误: 在Eclipse下启动tomcat的时候,报错为:Eclipse下启动to ...

  9. 学习中的错误——ubuntu 14.04 LTS 启动eclipse报错

    在ubuntu中启动eclipse报错:(Eclipse:15978): GLib-GIO-CRITICAL **: g_dbus_connection_get_unique_name: assert ...

随机推荐

  1. android sdk manager 无法更新,解决连不上dl.google.com的问题

    感谢博主的帮助,入口在这:https://www.jianshu.com/p/8fb367a51b9f?utm_campaign=haruki&utm_content=note&utm ...

  2. windows获取所有连接过的无线网密码

    一.打开命令行工具:win+R 输入cmd 回车进入: for /f "skip=9 tokens=1,2 delims=:" %i in ('netsh wlan show pr ...

  3. 出现ImportError: Python is not installed as a framework. The Mac OS X backend will not be able to function correctly ....的解决方法

    在terminal上运行gluoncv时遇到了一个报错问题. ImportError: Python is not installed as a framework. The Mac OS X bac ...

  4. 解决Intellij Idea下修改jsp页面不自动更新

    解决Intellij Idea下修改jsp页面不自动更新 On frame deactivation:被设置成了Do nothing 解决办法:改为Update resources(更新资源)或者Up ...

  5. 消息驱动微服务:Spring Cloud Stream

    最近在学习Spring Cloud的知识,现将消息驱动微服务:Spring Cloud Stream 的相关知识笔记整理如下.[采用 oneNote格式排版]

  6. 论文阅读笔记(二十三)【ECCV2018】:Robust Anchor Embedding for Unsupervised Video Person Re-Identification in the Wild

    Introduction 当前主要的非监督方法都采用相同的训练数据集,这些数据集在不同摄像头中是对称的,即不存在单个行人的错误项,这些方法将在实际场景中效果下降.在本方法中,作者引入了非对称数据,如下 ...

  7. Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set…

    php打印小票错误提示:Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activate ...

  8. SpringBoot整合NoSql--(一)Redis

    简介: Redis是一个开源的使用ANSI C语言编写.遵守BSD协议.支持网络.可基于内存亦可持久化的日志型.Key-Value数据库,并提供多种语言的API.它通常被称为数据结构服务器,因为值(v ...

  9. css3神奇的圆角边框、阴影框及其图片边框

    css3圆角,建议IE10以上 如果border-radius 单位是百分比,则参考为自身宽高,因此当宽高不一致时,圆角为不规则形状 如果border-radius 为50%,则为椭圆:当宽高一致时, ...

  10. 根据ip列表模拟输出redis cluster的主从对应关系

    需求:给点一批ip列表,一个数组或者一个文件,每行一个ip,模拟输出redis cluster的组从关系,前者是master_ip:master_port -> slave_ip:slave_p ...