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

SyntaxError when importing CreativeWritable #198

Open
seanmaxwell opened this issue Jan 30, 2023 · 3 comments
Open

SyntaxError when importing CreativeWritable #198

seanmaxwell opened this issue Jan 30, 2023 · 3 comments

Comments

@seanmaxwell
Copy link

When I import the CreativeWritable class to use it in a api call, I get back the following error:

Traceback (most recent call last):
  File "/Users/sean/dev/minimal-reproduction/main.py", line 1, in <module>
    from lob_python.model.creative_writable import CreativeWritable
  File "/Users/sean/dev/minimal-reproduction/venv/lib/python3.10/site-packages/lob_python/model/creative_writable.py", line 102
    'details': (, PostcardDetailsWritable, type(None)),  # noqa: E501
                ^
SyntaxError: invalid syntax

contents of main.py:

from lob_python.model.creative_writable import CreativeWritable

I have tried importing this class in a python 3.8 project and got the same result. The provided reproduction was done with python 3.10.


Full command line reproduction:

user@machine minimal-reproduction % python3 -m venv venv 
user@machine minimal-reproduction % source venv/bin/activate 
(venv) user@machine minimal-reproduction % pip install lob-python
Collecting lob-python
  Using cached lob-python-5.1.0.tar.gz (172 kB)
  Preparing metadata (setup.py) ... done
Collecting urllib3>=1.25.3
  Using cached urllib3-1.26.14-py2.py3-none-any.whl (140 kB)
Collecting python-dateutil
  Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Collecting six>=1.5
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Installing collected packages: urllib3, six, python-dateutil, lob-python
  DEPRECATION: lob-python is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Running setup.py install for lob-python ... done
Successfully installed lob-python-5.1.0 python-dateutil-2.8.2 six-1.16.0 urllib3-1.26.14
(venv) user@machine minimal-reproduction % pip list              
Package         Version
--------------- -------
lob-python      5.1.0
pip             22.3.1
python-dateutil 2.8.2
setuptools      65.6.3
six             1.16.0
urllib3         1.26.14
(venv) user@machine minimal-reproduction % python -c "from lob_python.model.creative_writable import CreativeWritable"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/sean/dev/minimal-reproduction/venv/lib/python3.10/site-packages/lob_python/model/creative_writable.py", line 102
    'details': (, PostcardDetailsWritable, type(None)),  # noqa: E501
                ^
SyntaxError: invalid syntax

Please let me know if you need more information. Thank you.

@seanmaxwell
Copy link
Author

seanmaxwell commented Jan 30, 2023

I am also seeing a similar error starting from importing the CampaignsApi:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/sean/.local/share/virtualenvs/web-k-_uvhwi/lib/python3.8/site-packages/lob_python/api/campaigns_api.py", line 25, in <module>
    from lob_python.model.campaign import Campaign
  File "/Users/sean/.local/share/virtualenvs/web-k-_uvhwi/lib/python3.8/site-packages/lob_python/model/campaign.py", line 32, in <module>
    from lob_python.model.campaign_creative import CampaignCreative
  File "/Users/sean/.local/share/virtualenvs/web-k-_uvhwi/lib/python3.8/site-packages/lob_python/model/campaign_creative.py", line 110
    'details': (, PostcardDetailsWritable, type(None)),  # noqa: E501
                ^
SyntaxError: invalid syntax

@BennyKitchell
Copy link
Contributor

@seanmaxwell Thanks for catching this, I don't have an immediate solution so will probably have to dig into a bit. I will update back here when I have a solution and a new version out.

@nick-JArmstrong
Copy link

nick-JArmstrong commented Apr 3, 2023

Is there a fix in sight for this issue? As far as I can tell any version >= 5.0.1 is not usable for this package for different issues. Should we continue to use v4.x.x of the lob API in python?

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

No branches or pull requests

3 participants