kaxil / airflowctl

A CLI tool to streamline getting started with Apache Airflow™ and managing multiple Airflow projects
Apache License 2.0
197 stars 15 forks source link

Scanner Error in settings.xml while initializing airflowctl project #42

Open sachinArya opened 3 weeks ago

sachinArya commented 3 weeks ago

Hi,

I am very new to this tool and was trying to setup airflowctl on my windows machine. When I ran the below command it came back with an error stating "ScannerError: while scanning a double-quoted scalar in "C:\projects\new-airflow-unit\my_airflow_project\settings.yaml", line 10, column 16 found unknown escape character 'p"

airflowctl init my_airflow_project --build-start

Seems like the path for venv specified should either have "\" or "/". However it can be corrected by manually updating it in settings.yaml file created. Not sure if it will have any impact?

kaxil commented 3 weeks ago

However it can be corrected by manually updating it in settings.yaml file created. Not sure if it will have any impact?

Could you try that and let me know what you see?

leo9986754 commented 2 weeks ago

"ScannerError: while scanning a double-quoted scalar in "C:\projects\new-airflow-unit\my_airflow_project\settings.yaml", line 10, column 16

Avoid using double quotes in YAML files. Use single quotes or no quotes.

MAlmohtadi commented 6 days ago

Is there any update on this issue?

kaxil commented 6 days ago

Is there any update on this issue?

Could you update the path manually in settings.yaml and give it a shot: https://github.com/kaxil/airflowctl/issues/42#issuecomment-2467348873

MAlmohtadi commented 6 days ago

I already did that but I encountered the below error message note I'm using windows 11 airflowctl build pyenv found. Using uv to install and set the desired Python version. Using CPython 3.11.9 interpreter at: C:\Users\User\AppData\Local\Programs\Python\Python311\python.exe Creating virtual environment at: .venv Activate with: .venv\Scripts\activate ┌─────────────────────────────── Traceback (most recent call last) ────────────────────────────────┐ │ C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\airflowctl\cli.py:115 in │ │ build │ │ │ │ 112 │ │ │ 113 │ mode_cls = _get_mode(config) │ │ 114 │ mode = mode_cls(project_path, python_version, airflow_version, **mode_config) │ │ > 115 │ venv_path = mode.build(recreate_venv=recreate_venv) │ │ 116 │ │ │ 117 │ typer.echo("Airflow project built successfully.") │ │ 118 │ return venv_path │ │ │ │ ┌─────────────────────────────────────────── locals ───────────────────────────────────────────┐ │ │ │ airflow_version = '2.10.3' │ │ │ │ config = { │ │ │ │ │ 'airflow_version': '2.10.3', │ │ │ │ │ 'python_version': '3.11.9', │ │ │ │ │ 'mode': { │ │ │ │ │ │ 'name': 'uv', │ │ │ │ │ │ 'config': {'venv_path': 'C:/summit-demo/.venv'} │ │ │ │ │ }, │ │ │ │ │ 'connections': None, │ │ │ │ │ 'variables': None │ │ │ │ } │ │ │ │ f = <_io.TextIOWrapper name='C:\\summit-demo\\settings.yaml' mode='r' │ │ │ │ encoding='cp1252'> │ │ │ │ mode = <airflowctl.modes.uv.UvMode object at 0x0000023BB505AF90> │ │ │ │ mode_config = {'venv_path': 'C:/summit-demo/.venv'} │ │ │ │ project_path = WindowsPath('C:/summit-demo') │ │ │ │ python_version = '3.11.9' │ │ │ │ recreate_venv = False │ │ │ │ settings_file = WindowsPath('C:/summit-demo/settings.yaml') │ │ │ └──────────────────────────────────────────────────────────────────────────────────────────────┘ │ │ │ │ C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\airflowctl\modes\uv.py:3 │ │ 4 in build │ │ │ │ 31 │ │ │ self.python_version = settings.get("python_version", INSTALLED_PYTHON_VERSIO │ │ 32 │ │ │ │ 33 │ │ # Create virtual environment │ │ > 34 │ │ venv_path = self.verify_or_create_venv( │ │ 35 │ │ │ venv_path=venv_path, │ │ 36 │ │ │ recreate=recreate_venv, │ │ 37 │ │ │ python_version=self.python_version, │ │ │ │ ┌───────────────────────────────── locals ──────────────────────────────────┐ │ │ │ recreate_venv = False │ │ │ │ self = <airflowctl.modes.uv.UvMode object at 0x0000023BB505AF90> │ │ │ │ venv_path = 'C:\\summit-demo\\.venv' │ │ │ └───────────────────────────────────────────────────────────────────────────┘ │ │ │ │ C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\airflowctl\modes\uv.py:7 │ │ 3 in verify_or_create_venv │ │ │ │ 70 │ │ │ print(f"[bold red]Virtual environment at {venv_path} does not exist or is no │ │ 71 │ │ │ raise SystemExit() │ │ 72 │ │ │ │ > 73 │ │ cls.create_virtualenv_with_specific_python_version(venv_path, python_version) │ │ 74 │ │ return venv_path │ │ 75 │ │ │ 76 │ @classmethod │ │ │ │ ┌──────────────────────── locals ─────────────────────────┐ │ │ │ python_version = '3.11.9' │ │ │ │ recreate = False │ │ │ │ venv_bin_python = 'C:\\summit-demo\\.venv\\bin\\python' │ │ │ │ venv_path = WindowsPath('C:/summit-demo/.venv') │ │ │ └─────────────────────────────────────────────────────────┘ │ │ │ │ C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\airflowctl\modes\uv.py:1 │ │ 01 in create_virtualenv_with_specific_python_version │ │ │ │ 98 │ │ venv_bin_python = os.path.join(venv_path, "bin", "python") │ │ 99 │ │ │ │ 100 │ │ # Continue with using the virtual environment │ │ > 101 │ │ subprocess.run([venv_bin_python, "-m", "ensurepip"], check=True) │ │ 102 │ │ subprocess.run([venv_bin_python, "-m", "pip", "install", "--upgrade", "pip", "uv │ │ 103 │ │ print( │ │ 104 │ │ │ f"Virtual environment created at [bold blue]{venv_path}[/bold blue] with Pyt │ │ │ │ ┌──────────────────────── locals ─────────────────────────┐ │ │ │ python_version = '3.11.9' │ │ │ │ venv_bin_python = 'C:\\summit-demo\\.venv\\bin\\python' │ │ │ │ venv_path = 'C:\\summit-demo\\.venv' │ │ │ └─────────────────────────────────────────────────────────┘ │ │ │ │ C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\subprocess.py:548 in run │ │ │ │ 545 │ │ kwargs['stdout'] = PIPE │ │ 546 │ │ kwargs['stderr'] = PIPE │ │ 547 │ │ │ > 548 │ with Popen(*popenargs, **kwargs) as process: │ │ 549 │ │ try: │ │ 550 │ │ │ stdout, stderr = process.communicate(input, timeout=timeout) │ │ 551 │ │ except TimeoutExpired as exc: │ │ │ │ ┌──────────────────────────────────── locals ────────────────────────────────────┐ │ │ │ capture_output = False │ │ │ │ check = True │ │ │ │ input = None │ │ │ │ kwargs = {} │ │ │ │ popenargs = (['C:\\summit-demo\\.venv\\bin\\python', '-m', 'ensurepip'],) │ │ │ │ timeout = None │ │ │ └────────────────────────────────────────────────────────────────────────────────┘ │ │ │ │ C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\subprocess.py:1026 in __init__ │ │ │ │ 1023 │ │ │ │ │ self.stderr = io.TextIOWrapper(self.stderr, │ │ 1024 │ │ │ │ │ │ │ encoding=encoding, errors=errors) │ │ 1025 │ │ │ │ │ > 1026 │ │ │ self._execute_child(args, executable, preexec_fn, close_fds, │ │ 1027 │ │ │ │ │ │ │ │ pass_fds, cwd, env, │ │ 1028 │ │ │ │ │ │ │ │ startupinfo, creationflags, shell, │ │ 1029 │ │ │ │ │ │ │ │ p2cread, p2cwrite, │ │ │ │ ┌─────────────────────────────────────────── locals ───────────────────────────────────────────┐ │ │ │ args = ['C:\\summit-demo\\.venv\\bin\\python', '-m', 'ensurepip'] │ │ │ │ bufsize = -1 │ │ │ │ c2pread = -1 │ │ │ │ c2pwrite = -1 │ │ │ │ close_fds = True │ │ │ │ creationflags = 0 │ │ │ │ cwd = None │ │ │ │ encoding = None │ │ │ │ env = None │ │ │ │ errors = None │ │ │ │ errread = -1 │ │ │ │ errwrite = -1 │ │ │ │ executable = None │ │ │ │ extra_groups = None │ │ │ │ gid = None │ │ │ │ gids = None │ │ │ │ group = None │ │ │ │ p2cread = -1 │ │ │ │ p2cwrite = -1 │ │ │ │ pass_fds = () │ │ │ │ pipesize = -1 │ │ │ │ preexec_fn = None │ │ │ │ process_group = -1 │ │ │ │ restore_signals = True │ │ │ │ self = <Popen: returncode: None args: ['C:\\summit-demo\\.venv\\bin\\python', │ │ │ │ '-m',...> │ │ │ │ shell = False │ │ │ │ start_new_session = False │ │ │ │ startupinfo = None │ │ │ │ stderr = None │ │ │ │ stdin = None │ │ │ │ stdout = None │ │ │ │ text = None │ │ │ │ uid = None │ │ │ │ umask = -1 │ │ │ │ universal_newlines = None │ │ │ │ user = None │ │ │ └──────────────────────────────────────────────────────────────────────────────────────────────┘ │ │ │ │ C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\subprocess.py:1538 in _execute_child │ │ │ │ 1535 │ │ │ │ │ 1536 │ │ │ # Start the process │ │ 1537 │ │ │ try: │ │ > 1538 │ │ │ │ hp, ht, pid, tid = _winapi.CreateProcess(executable, args, │ │ 1539 │ │ │ │ │ │ │ │ │ │ # no special security │ │ 1540 │ │ │ │ │ │ │ │ │ │ None, None, │ │ 1541 │ │ │ │ │ │ │ │ │ │ int(not close_fds), │ │ │ │ ┌─────────────────────────────────────────── locals ───────────────────────────────────────────┐ │ │ │ args = 'C:\\summit-demo\\.venv\\bin\\python -m ensurepip' │ │ │ │ attribute_list = {'handle_list': []} │ │ │ │ c2pread = -1 │ │ │ │ c2pwrite = -1 │ │ │ │ close_fds = True │ │ │ │ creationflags = 0 │ │ │ │ cwd = None │ │ │ │ env = None │ │ │ │ errread = -1 │ │ │ │ errwrite = -1 │ │ │ │ executable = None │ │ │ │ have_handle_list = False │ │ │ │ p2cread = -1 │ │ │ │ p2cwrite = -1 │ │ │ │ pass_fds = () │ │ │ │ preexec_fn = None │ │ │ │ self = <Popen: returncode: None args: │ │ │ │ ['C:\\summit-demo\\.venv\\bin\\python', '-m',...> │ │ │ │ shell = False │ │ │ │ startupinfo = <subprocess.STARTUPINFO object at 0x0000023BB442EB90> │ │ │ │ unused_gid = None │ │ │ │ unused_gids = None │ │ │ │ unused_process_group = -1 │ │ │ │ unused_restore_signals = True │ │ │ │ unused_start_new_session = False │ │ │ │ unused_uid = None │ │ │ │ unused_umask = -1 │ │ │ │ use_std_handles = False │ │ │ └──────────────────────────────────────────────────────────────────────────────────────────────┘ │ └──────────────────────────────────────────────────────────────────────────────────────────────────┘ FileNotFoundError: [WinError 2] The system cannot find the file specified

image

the folder is created but isn't completed,

image

MAlmohtadi commented 6 days ago

I noticed that the scripts are in the Scripts folder in Windows. but I tried to simulate the behavior inside docker I so the same scripts are inside the bin folder