当前位置: 首页>>代码示例>>Python>>正文


Python compat.FileNotFoundError方法代码示例

本文整理汇总了Python中pandas.compat.FileNotFoundError方法的典型用法代码示例。如果您正苦于以下问题:Python compat.FileNotFoundError方法的具体用法?Python compat.FileNotFoundError怎么用?Python compat.FileNotFoundError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pandas.compat的用法示例。


在下文中一共展示了compat.FileNotFoundError方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_nonexistent_path

# 需要导入模块: from pandas import compat [as 别名]
# 或者: from pandas.compat import FileNotFoundError [as 别名]
def test_nonexistent_path(all_parsers):
    # gh-2428: pls no segfault
    # gh-14086: raise more helpful FileNotFoundError
    parser = all_parsers
    path = "%s.csv" % tm.rands(10)

    msg = ("does not exist" if parser.engine == "c"
           else r"\[Errno 2\]")
    with pytest.raises(compat.FileNotFoundError, match=msg) as e:
        parser.read_csv(path)

        filename = e.value.filename
        filename = filename.decode() if isinstance(
            filename, bytes) else filename

        assert path == filename 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:18,代码来源:test_common.py

示例2: get_filepath_or_buffer

# 需要导入模块: from pandas import compat [as 别名]
# 或者: from pandas.compat import FileNotFoundError [as 别名]
def get_filepath_or_buffer(filepath_or_buffer, encoding=None,
                           compression=None, mode=None):

    if mode is None:
        mode = 'rb'

    fs = s3fs.S3FileSystem(anon=False)
    try:
        filepath_or_buffer = fs.open(_strip_schema(filepath_or_buffer), mode)
    except (compat.FileNotFoundError, NoCredentialsError):
        # boto3 has troubles when trying to access a public file
        # when credentialed...
        # An OSError is raised if you have credentials, but they
        # aren't valid for that bucket.
        # A NoCredentialsError is raised if you don't have creds
        # for that bucket.
        fs = s3fs.S3FileSystem(anon=True)
        filepath_or_buffer = fs.open(_strip_schema(filepath_or_buffer), mode)
    return filepath_or_buffer, None, compression, True 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:21,代码来源:s3.py

示例3: test_read_non_existant_read_table

# 需要导入模块: from pandas import compat [as 别名]
# 或者: from pandas.compat import FileNotFoundError [as 别名]
def test_read_non_existant_read_table(self):
        path = os.path.join(HERE, 'data', 'does_not_exist.' + 'csv')
        msg1 = r"File b'.+does_not_exist\.csv' does not exist"
        msg2 = (r"\[Errno 2\] File .+does_not_exist\.csv does not exist:"
                r" '.+does_not_exist\.csv'")
        with pytest.raises(FileNotFoundError, match=r"({}|{})".format(
                msg1, msg2)):
            with tm.assert_produces_warning(FutureWarning):
                pd.read_table(path) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:11,代码来源:test_common.py

示例4: test_nonexistent_path

# 需要导入模块: from pandas import compat [as 别名]
# 或者: from pandas.compat import FileNotFoundError [as 别名]
def test_nonexistent_path(self):
        # gh-2428: pls no segfault
        # gh-14086: raise more helpful FileNotFoundError
        path = '%s.csv' % tm.rands(10)
        pytest.raises(compat.FileNotFoundError, self.read_csv, path) 
开发者ID:birforce,项目名称:vnpy_crypto,代码行数:7,代码来源:common.py


注:本文中的pandas.compat.FileNotFoundError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。