g-battaglia / kerykeion

Data driven Astrology 💫
Kerykeion is a python library for astrology. It can generate SVG charts and extract all data about a birthchart, a synastry chart and a transit chart.
https://kerykeion.net
GNU Affero General Public License v3.0
297 stars 103 forks source link

unexpected keyword argument 'lang' error. #79

Closed korlog closed 1 year ago

korlog commented 1 year ago

Hello, I have a kr.config.json file located in the same location as the .py file. I don't use their original language translations in svg either. got an unexpected keyword argument 'lang' error. The code I use is as follows: name = KerykeionChartSVG(first, chart_type="Natal", new_output_directory="test", lang="MyLanguage" ,new_settings_file="kr.config.json")

How will I use these features?

g-battaglia commented 1 year ago

Hi, the config file path should be passed like this:

from kerykeion import AstrologicalSubject, KerykeionChartSVG
from pathlib import Path

# Create a AstrologicalSubject subject
subject = AstrologicalSubject("Kanye", 1977, 6, 8, 8, 45, "Atlanta", "USA")

# Create a KerykeionChartSVG, the default destination is the home directory of the user, but you can specify a path
HOME_DIR = str(Path.home())

# THE OUTPUT DIRECTORY MUST EXIST!
DOC_DIR = HOME_DIR + "/Documents"

# Current directory
CURRENT_DIR = Path(__file__).parent.absolute()

chart = KerykeionChartSVG(subject, new_output_directory=DOC_DIR, new_settings_file=CURRENT_DIR / "kr.config.json")

# Creates the SVG in the output directory
chart.makeSVG()
korlog commented 1 year ago

Thank you for the feedback, I produced the py file using the example you gave and I ran it, but the language I wanted (I wanted to choose CN as an example) does not appear properly in the svg file, the svg file is constantly produced using the EN language, the file content I used is as follows:

kr.config.json file: "general_settings": { "axes_orbit": 1, "planet_in_zodiac_extra_points": 10, "language": "CN" }

The file hierarchies are as follows:

g-battaglia commented 1 year ago

So far you need to include the full kr.config.json file, with all the keys, the merge functionality will be available in one of the next release.

korlog commented 1 year ago

image

Hello,

I did not delete or add the content of the kr.config.json file I got from the project, I just made "language": "CN" for testing the "language": "EN" value on line 519. When the code runs, it only generates EN values as svg.

If I add a 6th language (XYZ) such as 5 different languages available in the kr.config.json file, if I change the "language": "EN" value on line 519 with the 6th language code I just added (like "language": "XYZ") won't it take this into account when generating the svg? I wanted to use the language value dynamically.

As I said before, when I try to add the lang value in the last code you gave an example, it gives an error like this: got an unexpected keyword argument 'lang' error.

chart = KerykeionChartSVG(subject, lang="CN" new_output_directory=DOC_DIR, new_settings_file=CURRENT_DIR / "kr.config.json")

Thank you for your interest.

g-battaglia commented 1 year ago

Ok, I found the problem: Your code should be like this:

chart = KerykeionChartSVG(subject, new_output_directory=DOC_DIR, new_settings_file=CURRENT_DIR / "kr.config.json")

You must not pass the lang argument to KerykeionChartSVG