Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: unsupported operand type(s) for /: 'tuple' and 'str' #232

Open
geowat opened this issue Feb 25, 2022 · 10 comments
Open

TypeError: unsupported operand type(s) for /: 'tuple' and 'str' #232

geowat opened this issue Feb 25, 2022 · 10 comments

Comments

@geowat
Copy link

geowat commented Feb 25, 2022

I have just discovered this library. But the example is not even running and there seems to be a problem which may be related to the issue reported here. What is the work-around just to get the library going - any older versions which would work?

We use poetry for package management

[tool.poetry.dependencies]
python = "^3.10"
fastapi-code-generator = "^0.3.4"
fastapi = "^0.74.1"
path = root / "pyproject.toml"

TypeError: unsupported operand type(s) for /: 'tuple' and 'str'

@polysalama
Copy link

Having the same problem with a clean virtualenv on python 3.8.12 and 3.10.2.

@Davidswinkels
Copy link

Having the same issue on Python 3.9.7, fastapi-code-generator 0.3.4 and datamodel-code-generator 0.11.15 on Windows.

@asik03
Copy link

asik03 commented Mar 4, 2022

Quick fix:

In the source code /python3.9/site-packages/datamodel_code_generator/format.py:

I have changed manually in line 45

path = root / "pyproject.toml"

to

path = root[0] / "pyproject.toml"

The project was generated automatically after this change.

@Davidswinkels
Copy link

Davidswinkels commented Mar 4, 2022

Thanks asik03 it works again :) This fix also works for running datamodel_code_generator:

For that in /python3.9/site-packages/datamodel_code_generator/__main__.py line 432 had to be changed from:

pyproject_toml_path = root / "pyproject.toml"

to:

pyproject_toml_path = root[0] / "pyproject.toml"

@n0nvme
Copy link
Contributor

n0nvme commented Mar 14, 2022

duplicates #230

@rk0n
Copy link

rk0n commented May 4, 2022

Is it possible to push a new binary with this fix #231 ?

@olivergondza
Copy link

This is fixed in 0.3.5. Thanks!

@jayvdb
Copy link

jayvdb commented Sep 6, 2022

I think this issue should be closed.

@jcarlosgalvezm
Copy link
Contributor

Hi @koxudaxi,

When do you plan to publish the new changes to pypi?

Thank you!

@n0nvme
Copy link
Contributor

n0nvme commented Sep 16, 2022

@jcarlosgalvezm It's already published in 0.3.5 release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants