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

Fix build index problem in reinstallation #16

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

OftenLin
Copy link

@OftenLin OftenLin commented Feb 17, 2019

As the error code while doing reinstallation(remove and install again):

Traceback (most recent call last):
  File "setup.py", line 52, in <module>
    cmdclass = {'install': zipcodetw_install},
  File "...\lib\site-packages\setuptools-40.8.0-py3.6.egg\setuptools\__init__.py", line 145, in setup
  File "...\appdata\local\programs\python\python36-32\Lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "...\appdata\local\programs\python\python36-32\Lib\distutils\dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "...\appdata\local\programs\python\python36-32\Lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
  File "setup.py", line 14, in run
    zipcodetw.builder.build()
  File "...\zipcodetw\zipcodetw\builder.py", line 23, in build
    dir_.load_chp_csv(csv_f)
  File "...\zipcodetw\zipcodetw\util.py", line 317, in method_wrapper
    retval = method(self, *args, **kargs)
  File "...\zipcodetw\zipcodetw\util.py", line 335, in load_chp_csv
    self.create_tables()
  File "...\zipcodetw\zipcodetw\util.py", line 241, in create_tables
    ''')
sqlite3.OperationalError: table precise already exists

The code in setup.py: zipcodetw.builder.build() will cause the error above which need to [try expect] to let reinstallation can be successfully, thxs ~

@OftenLin OftenLin changed the title solved build index problem in reinstallation Fixed build index problem in reinstallation Feb 17, 2019
@OftenLin OftenLin changed the title Fixed build index problem in reinstallation Fix build index problem in reinstallation Feb 17, 2019
zipcodetw.builder.build()
try:
zipcodetw.builder.build()
except:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should catch only sqlite's exception .

A better approach is to fix the code inside .builder

Copy link
Contributor

@jayvdb jayvdb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note I also encounter this when installing for the first time in rpmbuild, because packaging splits setup.py build and setup.py install into two steps. Thanks for the fix.
https://build.opensuse.org/package/show/home:jayvdb:py-new/python-zipcodetw

@moskytw
Copy link
Owner

moskytw commented Aug 8, 2021

Hmmm ... I can install after uninstall or --force-reinstall normally. Maybe the issue got fixed?

@moskytw moskytw closed this Aug 8, 2021
@jayvdb
Copy link
Contributor

jayvdb commented Aug 8, 2021

Hmmm ... I can install after uninstall or --force-reinstall normally. Maybe the issue got fixed?

Sounds like you were using pip and had an environment which doesnt replicate the problem.

Try using setup.py build followed by setup.py install in a clean environment.

Nothing has exception handling if the tables already exist.

@moskytw moskytw reopened this Aug 12, 2021
@moskytw
Copy link
Owner

moskytw commented Sep 9, 2021

Could you kindly confirm the issue is same as #31?

@jayvdb
Copy link
Contributor

jayvdb commented Sep 9, 2021

It is unrelated to #31

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

Successfully merging this pull request may close these issues.

3 participants