Skip to content

SyntaxError when importing CreativeWritable #198

Open

Description

@seanmaxwell

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.

Activity

  1. seanmaxwell commented on Jan 30, 2023

    @seanmaxwell
    Author

    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
  2. BennyKitchell commented on Jan 31, 2023

    @BennyKitchell
    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.

  3. nick-JArmstrong commented on Apr 3, 2023

    @nick-JArmstrong

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions