简体   繁体   English

OSError: [WinError 123] 当我创建 kfp 组件时

[英]OSError: [WinError 123] when I create kfp component

I'm trying to create a pipeline in Vertex AI with kfp using my own components from local notebook in Spyder.我正在尝试使用我自己的组件在 Spyder 的本地笔记本中使用 kfp 在 Vertex AI 中创建管道。

When I run the following piece of code:当我运行以下代码时:

@component(base_image="python:3.9", packages_to_install=["pandas"])
def create_dataset(
    gcs_csv_path_train: str,
    dataset: Output[Dataset],
):
    import pandas as pd
    df = pd.read_csv(gcs_csv_path_train)
    dataset = df.pop('Class')

I get the following error:我收到以下错误:

OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: '<ipython-input-11-b28c15ec667f>'

The error is not raised if I use a Jupyter notebook online.如果我在线使用 Jupyter 笔记本,则不会引发该错误。

What am I doing wrong?我究竟做错了什么? Thanks.谢谢。

You need to check the file path that you use in your code.您需要检查您在代码中使用的文件路径。 Because there are some characters that are not accepted such as the colon “ : ” in Windows file names.因为有些字符是不被接受的,比如 Windows 文件名中的冒号“:”。 You can see more documentation about Windows standar paths.您可以查看有关 Windows 标准路径的更多文档

When using the path in the python code, please follow below:在python代码中使用路径时,请遵循以下操作:

  • Use 'r' before any path- The r is a string literal that lets treat any string as a raw string, which means all escape codes will be ignored.在任何路径之前使用 'r' - r 是一个字符串文字,可以将任何字符串视为原始字符串,这意味着所有转义码都将被忽略。
  • Use either double quotes “file-path” or single quote 'file-path' to specify the path.使用双引号“file-path”或单引号“file-path”来指定路径。
  • Don't use a combination of both “” or '不要同时使用“”或“

Correct file path is as below正确的文件路径如下

filepath = r'C:\Test\file\file-input-thecodebuzz.txt'

OR或者

filepath = r"C:\Test\file\file-input-thecodebuzz.txt"

You can see more documentation .您可以查看更多文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何修复 OSError: [WinError 123] 发布到 PyPi 时 - How to fix OSError: [WinError 123] when publishing to PyPi 在 VS Code 中使用 Jupyter 时出现 OSError [WinError 123] - OSError [WinError 123] when using Jupyter within VS Code Python - os.rename() - OSError: [WinError 123] - Python - os.rename() - OSError: [WinError 123] 启动 Kernel 失败。 操作系统错误:[WinError 123] - Failed to start the Kernel. OSError: [WinError 123] OSError:[WinError 123]文件名,目录名或卷标语法不正确 - OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect OSError: [WinError 123] 文件名、目录名或卷 label 语法不正确: - OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: OSError:[WinError 123],它将符号添加到文件路径并引发此错误 - OSError: [WinError 123], it adds simbols to file path and raise this error 如何使用 OSError 修复 pyspark NLTK 错误:[WinError 123]? - How to fix pyspark NLTK Error with OSError: [WinError 123]? OSError: [WinError 126] 在 python 中导入库时 - OSError: [WinError 126] when importing a library in python OSError:[WinError 123] 文件名、目录名或卷 label 语法不正确:[Python] - OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: [Python]
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM