The Wayback Machine - http://web.archive.org/web/20250413111429/https://github.com/dbcli/pgcli/issues/1270
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

Bad temp file handling #1270

Closed

olivier65 opened this issue May 19, 2021 · 5 comments
Closed

Bad temp file handling #1270

olivier65 opened this issue May 19, 2021 · 5 comments
Labels

Comments

@olivier65
Copy link

olivier65 commented May 19, 2021

Description

  1. invoke pgcli
  2. \l
  3. q
  4. crash:
Traceback (most recent call last):
  File "C:\Python\3.8\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Python\3.8\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "<redacted>\venv\Scripts\pgcli.exe\__main__.py", line 7, in <module>
  File "<redacted>\venv\lib\site-packages\click\core.py", line 1134, in __call__
    return self.main(*args, **kwargs)
  File "<redacted>\venv\lib\site-packages\click\core.py", line 1059, in main
    rv = self.invoke(ctx)
  File "<redacted>\venv\lib\site-packages\click\core.py", line 1401, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "<redacted>\venv\lib\site-packages\click\core.py", line 767, in invoke
    return __callback(*args, **kwargs)
  File "<redacted>\venv\lib\site-packages\pgcli\main.py", line 1336, in cli
    pgcli.run_cli()
  File "<redacted>\venv\lib\site-packages\pgcli\main.py", line 765, in run_cli
    query = self.execute_command(text)
  File "<redacted>\venv\lib\site-packages\pgcli\main.py", line 684, in execute_command
    self.echo_via_pager("\n".join(output))
  File "<redacted>\venv\lib\site-packages\pgcli\main.py", line 1085, in echo_via_pager
    click.echo_via_pager(text, color=color)
  File "<redacted>\venv\lib\site-packages\click\termui.py", line 302, in echo_via_pager
    return pager(itertools.chain(text_generator, "\n"), color)
  File "<redacted>\venv\lib\site-packages\click\_termui_impl.py", line 357, in pager
    return _tempfilepager(generator, "more <", color)
  File "<redacted>\venv\lib\site-packages\click\_termui_impl.py", line 440, in _tempfilepager
    os.unlink(filename)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: '%TEMP%\\tmp_cpxsj61'

Happens 100% reliably.

Your environment

Windows 10 version 21H1
python 3.8.10
python packages (in a clean venv in which pgcli is the only package installed manually):

cli-helpers==2.1.0
click==8.0.0
colorama==0.4.4
configobj==5.0.6
pendulum==2.1.2
pgcli==3.1.0
pgspecial==1.12.1
prompt-toolkit==3.0.18
psycopg2==2.8.6
Pygments==2.9.0
python-dateutil==2.8.1
pytzdata==2020.1
setproctitle==1.2.2
six==1.16.0
sqlparse==0.4.1
tabulate==0.8.9
terminaltables==3.1.0
wcwidth==0.2.5
@kamusis
Copy link

kamusis commented Jun 8, 2021

Try to downgrade click 8.0.0 to click 7.1.2.
python3 -m pip install click==7.1.2
then rerun pgcli, issue should be resolved.

@olivier65
Copy link
Author

olivier65 commented Jun 8, 2021

Yes, I had already done that. But please update your setup.py, too.

@j-bennet
Copy link
Contributor

j-bennet commented Jun 11, 2021

I filed an issue in click: pallets/click#1956.

@ERYoung11
Copy link
Contributor

ERYoung11 commented Sep 2, 2022

@j-bennet @olivier65 This appears to have been fixed by Click Pull 2036
I have a Windows environment with the latest build and can't reproduce this. @olivier65 Can you confirm?

@dbaty
Copy link
Member

dbaty commented Mar 5, 2024

Thanks for trying to reproduce, @ERYoung11. Since we have no news from the original reporter on this 3-year old issue, I am closing this.

@dbaty dbaty closed this as completed Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants