Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
23 views

PyYAML - error: subprocess-exited-with-error [duplicate]

I got this error when trying to install PyYAML Collecting PyYAML==5.4.1 (from -r /xxx/src/requirements_2.txt (line 21)) Using cached PyYAML-5.4.1.tar.gz (175 kB) Installing build dependencies ... ...
Nurdin's user avatar
  • 23.8k
0 votes
1 answer
19 views

Python script to read credentials from a yaml file, read a dataset and update information

I'm working on an academic project where I need to create a python script to change credentials from a yaml file. This script should read the yaml file, then look for the value of Oauth 1 in a ...
rdinil's user avatar
  • 1
0 votes
0 answers
21 views

Installing pyYAML 6.0.2 on RHEL8

I'm trying to install the pyYAML library on a RHEL8 server that doesn't have internet access. Since I can't use pip directly, I'm manually downloading the necessary packages and transferring them to ...
Harpreet Singh's user avatar
1 vote
2 answers
51 views

How to register dependencies programmatically in a Python DVC pipeline

I want to run a sequence of experiments and each experiment will use certain input data files (dependencies), each of which I want to prepare when an experiment is run. (Some experiments will use the ...
Bill's user avatar
  • 11.4k
0 votes
0 answers
24 views

How to use pyyaml to create/modify conjur policy yaml files

I am working with conjur yaml policies formatted like this: - !policy id: parent-id body: - !policy id: child1 body: - &child1-variables - !variable var1 ...
jlrivera81's user avatar
1 vote
1 answer
77 views

How can I tell Pyyaml to convert PosixPath to str in yaml.dump?

I understand that YAML allows you to represent arbitrary data using tags. I would like to convert a PosixPath to a str instead of representing it as a !!pathlib.PosixPath. How can I tell pyyaml to ...
xaviersjs's user avatar
  • 1,715
0 votes
1 answer
90 views

How to use create Python Dataclasses from YAML with default_factory?

I'm trying to create dataclasses directly from YAML description, with some attributes having a default value. Based on the document of py.yaml, I know that I can register some tags to automatically ...
Jean-Francois T.'s user avatar
0 votes
2 answers
117 views

How do I install Yotta through pip

I am unable to install Yotta on my Windows 11 system. I have installed the dependencies but when I execute the following on python 3.12, pip version 24.0, it fails. pip install -U yotta The error ...
Bobson Tobson's user avatar
1 vote
1 answer
70 views

How to read external config file in Django and have it available everywhere

I want to define an external config file, for example, in Yaml. How can I read it in once at initialization and then have it available everywhere, without having to re-read the file each time? For ...
Peter Kronenberg's user avatar
0 votes
2 answers
125 views

How to override the base resolver in pyyaml

I have found several comments and a similar question on how to override the resolver. https://github.com/yaml/pyyaml/issues/376#issuecomment-576821252 @StrayDragon Actually you can change this ...
Diego's user avatar
  • 954
0 votes
1 answer
169 views

Dump JSON as multline String in Python with PyYaml

I need to do a roundtrip with some Kubernetes Resources to alter it in some way with Python (3.11). Now i have t following ConfigMap-Resource: apiVersion: v1 kind: ConfigMap metadata: name: sample-...
Oliver Zabel's user avatar
0 votes
1 answer
84 views

Adjust yaml.Dumper to export dataclasses and their docstrings

I would like to export dataclass objects including their docstrings (as # commented description above) to yaml. So far I've figured out that I need a custom dumper or adjust the current one. from ...
Daraan's user avatar
  • 2,934
0 votes
0 answers
35 views

How to check the multiple $refs in yaml schema using jsonschemavalidator in python

I have a Yaml api schema saved in a local file, C:/Users/test/api.yaml, a schema(AppSettings) in that is having multiple references where the references are existing in same file, but I'm not able to ...
praseetha cp's user avatar
1 vote
1 answer
66 views

How do I "merge" my output into an existing YAML file with PyYAML?

I am trying to add data to foo.yaml from a string like this: foo.yaml # other stuff in the file packages: # doesn't have to exist - 1 - 2 - 3 # other stuff in the file the string packages: - ...
SvGaming's user avatar
0 votes
0 answers
11 views

why output of yaml.safe_load('1:1') returns a number not an error? [duplicate]

I missed a space after :, but found an interesting result. I couldn't get why the output is 6241. >>> import yaml >>> >>> yaml.safe_load('104:1') 6241
Rilwan's user avatar
  • 2,291
0 votes
0 answers
22 views

How is a yaml file suppposed to load in my Python script?

I'm trying to clone a remote repo, open a certain yaml file, update a couple keys, then stage and push it back to remote. But I can't stage nor commit the file, since my script seems to be ignoring my ...
c0d3rbox's user avatar
1 vote
1 answer
143 views

RUAMEL/PYYAML writting new lines to yaml

I have a large yaml configuration file I am editing. This is the ideal format. ... - name: apple Formula: |- x = 3 + 4; apple = x * 3 + y; Inputs: - y - name: banana Formula: |- x =...
Ryan Pond's user avatar
0 votes
0 answers
91 views

Find duplicates in environment variables defined in YAML file

I have a kubernetes deployment YAML file, with defined environment variables including duplicated environment variables. My goal is detect them and print them, as I have hundreds of files which needs ...
Aziz Zoaib's user avatar
0 votes
2 answers
96 views

Deleting content from a YAML file using Python while retaining the original structure

I have a YAML file. I want to use my script to repo all "repository" instances that are not contained in a list of strings I have defined. My script: import yaml core_repos = ["REPO1&...
Rattletrap's user avatar
4 votes
1 answer
3k views

Unable to install PyYaml using Poetry

I'm trying to build a virtual environment using Poetry v1.7.1 on Mac, thru poetry install with a pyproject.toml like this: [tool.poetry] ... [tool.poetry.dependencies] python = "^3.9" mlrun ...
George Liu's user avatar
  • 3,533
1 vote
1 answer
982 views

RuntimeError: can't create new thread at interpreter shutdown

This is a forked repository from Github and when I try to deploy it to Heroku it shows the error: 2023-12-31T03:10:27.965787+00:00 app[web.1]: 2023-12-31T03:10:27.965828+00:00 app[web.1]: ...
Vivek Tp's user avatar
0 votes
1 answer
160 views

How can I extract certain qualified nodes from a yaml document and add to a new document using PyYAML? [closed]

I'm new with both Python and YAML (great with Javascript and JSON) and I need to construct a subset of a YAML file. In particular, I want to generate a .yaml file that can be used to create a new ...
svenyonson's user avatar
  • 1,899
0 votes
1 answer
54 views

Load element as string when it ends with a colon

I have a YAML document where some values end with a colon, something like: foo: - bar - baz:: When I load the document with yaml.load, the baz:: element gets converted to a dictionary {'baz:' : ''...
Mike van Dyke's user avatar
0 votes
0 answers
215 views

python pyyaml: dump in block style, but how to keep any list as single line output?

I have a yaml file that also needs to be compatible to an existing black-box software that requires lists to appear on a single line, i.e. not block style, while everything else is expected in block ...
isbjörnen's user avatar
0 votes
0 answers
31 views

Fatal Error on installing cumulusci via pipx due to pyyaml on MacOS [duplicate]

I am trying to install cumulusci via pipx on my MacOS machine but I keep running into a fatal error related to pyyaml. Here is the command I am running: pipx install cumulusci And here is the error ...
ana_nymous13's user avatar
0 votes
1 answer
40 views

Pyyaml - Python , omit !!int

Is there a way to remove !!int after dumping to a yaml file? Current output: "cores": !!int "4" "disks": !!int "200" Expected: "cores": "4&...
Yousef Almutairi's user avatar
3 votes
1 answer
2k views

How can I dump a Python dataclass to YAML without tags?

I have a nested dataclasses that I would like to convert and save to the yaml format using the PyYaml library. The resultant YAML output contains YAML tags which I would like to remove. I have the ...
otherJL0's user avatar
2 votes
2 answers
95 views

How to make the `yaml.dump({1}) ` output "? 1" instead of "1: null" in Python?

This code in Python: import yaml data = {1} print(yaml.dump(data)) prints: !!set 1: null Is it possible to make this output: !!set ? 1 I think we should be able to do it, because this code: ...
Osama Adel's user avatar
0 votes
0 answers
39 views

pyyaml: dump set without null values

By default, pyyaml seems to dump sets like this: test_set: !!set member_a: null member_b: null However, I would prefer it to do this instead: test_set: !!set {'member_a', 'member_b'} which is ...
mara004's user avatar
  • 2,164
1 vote
1 answer
110 views

How to use ruamel.yaml to output line-delimited/formatted json block?

I'm currently using this code block with pyyaml, but I want to get the same thing done with ruamel.yaml import yaml import json envList=envList={"env":"development", "region&...
Daniel Sarfati's user avatar
0 votes
0 answers
62 views

jenkins job fails with yaml has no attribute full loader

i have upgraded the Pyyaml version to 5.3.1. Python 3.8.10 (default, May 26 2023, 14:05:08) [GCC 9.4.0] on linux Type "help", "copyright", "credits" or "license"...
Arun Gala's user avatar
0 votes
1 answer
122 views

Python Script trying to generate a YAML file (Containerlab topology file) as output but getting the wrong format

I am currently working on a Python file that aims to generate a "custom" containerlab topolgy file - yaml format - but I am getting a different output than expected and I am struggling big ...
CDP's user avatar
  • 3
1 vote
1 answer
587 views

How to check yaml Schema in multiple levels using Python

If the yaml file is valid, the method yaml.safe_load() will convert the file to a dictionary (in the code is represented by the variable CONFIG). After the first validation, it should check each key ...
Luiz's user avatar
  • 343
1 vote
1 answer
936 views

Python Yaml parse inf as float

In PyYaml or ruamel.yaml I'm wondering if there is a way to handle parsing of specific strings. Specifically, I'd like to be able to parse "[inf, nan]" as [float('inf'), float('nan')]. I'll ...
Erotemic's user avatar
  • 5,148
0 votes
0 answers
38 views

How to dump a non dictionary python object to YAML

I'm trying to write the yaml config file for the ROS2 domain bridge from a python script. At the end it should like this: name: ol_bridge topics: simulation/odometry: type: nav_msgs/msg/Odometry ...
user17579347's user avatar
0 votes
1 answer
117 views

Modify included YAML file

I have 2 yaml files. Let's call the first login.yaml: id: 1 login: user: name pass: secret I am including this file in another yaml file called config.yaml. Now I want to add a new key (which ...
khl's user avatar
  • 65
1 vote
1 answer
113 views

ruamel creating empty blank lines after comment

I'm struggling with doing a roundtrip parsing of a YAML file using ruamel. Below is an example YAML file, input.yaml: ##### Header comment #### key: #comment1 key2: val2 Below is the python code ...
SeekerN's user avatar
  • 97
0 votes
1 answer
242 views

Building Docker image with `pip3 install pyyaml` returns error: "ImportError: No module named 'importlib.resources'"

This is my dockerfile: FROM tensorflow/tensorflow:1.6.0-devel-gpu-py3 COPY ./home/ /home/ RUN mkdir /usr/java \ && cp -r /home/SySeVR/softdir/jdk1.8.0_161 /usr/java \ && mkdir /usr/ant ...
Tasnim Fabiha's user avatar
66 votes
10 answers
38k views

Docker-compose no longer building image (AttributeError: cython_sources)

I am building a django-react site and suddenly my docker-compose no longer builds despite any changes to requirements or image versions. My requirements.txt looks as follows: Django>=3.2.4,<4.0 ...
Marco Sousa's user avatar
8 votes
4 answers
12k views

Issue importing PyYAML, cltk

I just got a MacBook, cloned the project I was working on, and went to set up the python environment. After creating the environment, I updated pip and tried installing the necessary libraries using ...
mikerabs's user avatar
1 vote
2 answers
640 views

How to dump a string read from a text file into a YAML file without single quotes

I have a string which is a 32-byte hash of a .hex file. It is of the format 0x88f8ad77bb388f63674991a8692618a459bec731d15e6c8cf3755050af98a075. I have to read this string from a text file and dump it ...
Pooja Shanker's user avatar
1 vote
1 answer
634 views

Why are enum members in Python 3.10 and 3.11 serialized to YAML differently?

Using this snippet: import sys import yaml try: from enum import ReprEnum except ImportError: from enum import Enum as ReprEnum class MyEnum(int, ReprEnum): foo = 123 print('Python ...
ThiefMaster's user avatar
1 vote
1 answer
317 views

How to make a dynamic yaml questionnaire with Python?

- question: "What is your name?" type: text required: true - question: "How old are you?" type: number required: true min_value: 18 max_value: 100 - question: "...
ProxilityProblemSolver's user avatar
-1 votes
1 answer
990 views

PyYAML dumping a long string over multiple lines

pyYAML is dumping a long string over multiple lines. I want the output to be like this - include: - interface Vlan6[\s]+vrrpv3 1 address-family ipv4[\s]+address 5.2.1.1 primary[\s]+interface Vlan7[\...
Naman Sharma's user avatar
0 votes
2 answers
854 views

PyYAML dumps Python dictionary with tags

I don't understand why yaml.dump adds tags and weird informations into result: Source file.yml content is : ssh_keys: user1: - key: key1 state: state1 I want to add to the file the ...
timothepoznanski's user avatar
0 votes
1 answer
181 views

Using pyyaml, how can I override an anchor in a YAML config and have the updated anchor be persisted throughout?

Here's an example of the file config.yml: key_setting: &key_setting True main_params: param_A: param_A_1: 1 param_A_2: 2 param_A_setting: *key_setting param_B: param_B_1: 3 ...
nwly's user avatar
  • 1,491
1 vote
1 answer
114 views

YAML representation of a dictionary from multi-level Ctype Structure gets a strange object

TL;DR: I have a ctype Structure with another Structure inside, which I convert (seemingly correct) to a python dictionary, then I attempt to dump it into YAML. However the value of the internal ...
István Szekér's user avatar
-1 votes
1 answer
415 views

Python YAML parsing raising KeyError

I am trying to build an audit report of which users will have access to which topics in our kafka environment. I wrote a piece of python code that does this, but for some reason it stopped working, ...
BashNewbie's user avatar
2 votes
2 answers
2k views

How to export a Pydantic model instance as YAML with URL type as string

I have a Pydantic model with a field of type AnyUrl. When exporting the model to YAML, the AnyUrl is serialized as individual field slots, instead of a single string URL (perhaps due to how the AnyUrl....
morfys's user avatar
  • 2,365
-1 votes
2 answers
782 views

Variables and their values are stored externally in a YAML file. How to read them as if I declare them internally?

Instead of having to declare the variables and their values in the script, I would like to have them declared externally in a separate YAML file called settings.yml: setting1: cat setting2: dog Is ...
Ooker's user avatar
  • 2,698

1
2 3 4 5
17