python 使用中遇到的问题,记录及解决方法

1、读取configparser 配置文件报错   :

提示:

ConfigParser.MissingSectionHeaderError when parsing rsyncd config file with global options

解决方法:

https://stackoverflow.com/questions/22501121/configparser-missingsectionheadererror-when-parsing-rsyncd-config-file-with-glob

cfg = configparser.ConfigParser()
    with open(file,‘r‘) as fp:
        cfg.read_file(itertools.chain([‘[global]‘], fp), source=file)

# config.read(file,encoding=‘utf-8‘)
    gw_sip = cfg.get(‘test_sip_endpoint‘,‘gw_sip‘)

原文地址:https://www.cnblogs.com/Ray-Lei/p/10251675.html

时间: 2024-08-09 21:58:34

python 使用中遇到的问题,记录及解决方法的相关文章

Python IOError: [Errno 22] invalid mode ('r') 解决方法

O'Reilly出版的Wes McKinney编的<Python for Data Analysis> 本人使用工具: PyCharm 2016.3.2 rnames =['user_id','movie_id','rating','time_cd'] ratings = pd.read_table('data\ml-1m\ratings.dat',sep='::',header=None,names=rnames) 报错信息如下: 原因:\ratings.dat 中的 "\r&qu

Python使用easy-install安装时报UnicodeDecodeError的解决方法

Python使用easy-install安装时报UnicodeDecodeError的解决方法,有需要的朋友可以参考下. 问题描述: 在使用easy-install安装matplotlib.pyparsing时一直报如下错误: File "G:\Python27\lib\ntpath.py", line 84, in join result_path = result_path + p_path UnicodeDecodeError: 'ascii' codec can't decod

Ubuntu下 fatal error: Python.h: No such file or directory 解决方法

参考: fatal error: Python.h: No such file or directory Ubuntu下 fatal error: Python.h: No such file or directory 解决方法 根据使用的Python版本安装python-dev库. sudo apt-get install python-dev # for python2.x installs sudo apt-get install python3-dev # for python3.x i

windows下Python开发错误记录以及解决方法

windows下使用pip提示ImportError: cannot import name 'main' 原因:将pip更新为10.0.0后库里面的函数有所变动造成这个问题 解决方法:先卸载现在的pip: python -m pip uninstall pip 然后重装:python -m pip install pip==19.0.3 原文地址:https://www.cnblogs.com/mm1994/p/11763860.html

Python: 安装 sklearn 包出现错误的解决方法

今天在安装python 的 sklearn 包时出现了 Cannot uninstall 'numpy' 和 Cannot uninstall 'scipy' 错误,下面记录了我尝试了很多网上的方法后最终成功的解决方法. 终端执行 pip install scikit-learn 后,出现 Cannot uninstall 'numpy'. It is a distutils installed project and thus we cannot accurately determine wh

GAE下python之importmodules{No module named %s}解决方法

笔者菜菜,想看看github上tornado写的demo ---blog,于是在github上粘贴复制,粘贴复制, 用GAE打开的时候发现跑不起来,看看log File "E:\Python27\lib\ctypes\__init__.py", line 10, in <module> from _ctypes import Union, Structure, Array File "E:\GAE\google\appengine\tools\devappserv

处理微操作记录的解决方法

当我们写web项目的时候有可能会遇到一个问题,进行保存操作的时候要保存,但是如果用户没有保存,我们可能还要保存一个未保存的记录,那么如果要捕捉到用户没有保存的信息很难,需要捕捉用户关闭页面,用户关闭浏览器等等其他的操作,其实最直接的解决方法是当用户为保存之前,默认就存入未保存的记录,当用户点击保存的时候再删除这条记录,这样也是最直接的方式.这样解决应该是最方便的了

python错误:No module named setuptools 解决方法

MySQL-python是Python访问MySQL数据库的第三方模块库: 在安装过程中出现如下错误: [[email protected] MySQL-python-1.2.5]# python setup.py install Traceback (most recent call last): File "setup.py", line 7, in <module> import setuptools ImportError: No module named setu

python 字符串转列表出现\ufeff的解决方法

在学习python从文件中读取文件,并将文件中的字符串转化为列表的时候,发现文件头多了一个\ufeff字符. 这个问题前段时间也遇到过了,同样是上网搜索了半天才解决,当时只是把问题解决就过去了,但是今天遇到同样的问题时,知道有这么一个解决方法,但是怎么做就是想不起来.古人云,好记性不如烂笔头,一点没错.进入正题. 几个概念性的东西  ANSCII:  标准的 ANSCII 编码只使用7个比特来表示一个字符,因此最多编码128个字符.扩充的 ANSCII 使用8个比特来表示一个字符,最多也只能 编