shot-scraper icon indicating copy to clipboard operation
shot-scraper copied to clipboard

weired pdf error

Open shopconan opened this issue 2 years ago • 3 comments

url to pdf ERROR b'Traceback (most recent call last):\n File "/opt/hostedtoolcache/Python/3.10.4/x64/bin/shot-scraper", line 8, in \n sys.exit(cli())\n File "/opt/hostedtoolcache/Python/3.10.4/x64/lib/python3.10/site-packages/click/core.py", line 1130, in call\n return self.main(*args, **kwargs)\n File "/opt/hostedtoolcache/Python/3.10.4/x64/lib/python3.10/site-packages/click/core.py", line 1055, in main\n rv = self.invoke(ctx)\n File "/opt/hostedtoolcache/Python/3.10.4/x64/lib/python3.10/site-packages/click/core.py", line 1657, in invoke\n return _process_result(sub_ctx.command.invoke(sub_ctx))\n File "/opt/hostedtoolcache/Python/3.10.4/x64/lib/python3.10/site-packages/click/core.py", line 1404, in invoke\n return ctx.invoke(self.callback, **ctx.params)\n File "/opt/hostedtoolcache/Python/3.10.4/x64/lib/python3.10/site-packages/click/core.py", line 760, in invoke\n return __callback(*args, **kwargs)\n File "/opt/hostedtoolcache/Python/3.10.4/x64/lib/python3.10/site-packag...

pdfname=url.split('/')[-1]

if not os.path.exists(join(pdfpath,pdfname+'.pdf')):
    cmd='shot-scraper pdf {url} -o {pdfname}.pdf'
    isdone=subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
    out, err = isdone.communicate()

shopconan avatar May 20 '22 00:05 shopconan

shot-scraper pdf https://www.indiehackers.com/interview/growing-a-sound-effects-app-for-mac-to-1-000-mo-f522c242fc -o growing-a-sound-effects-app-for-mac-to-1-000-mo-f522c242fc.pdf url to pdf ERROR b"Screenshot of 'https://www.indiehackers.com/interview/growing-a-sound-effects-app-for-mac-to-1-000-mo-f522c242fc' written to 'growing-a-sound-effects-app-for-mac-to-1-000-mo-f522c242fc.pdf'\n" b'' @simonw

shopconan avatar May 20 '22 00:05 shopconan

another windows machine 3.8.0

 shot-scraper pdf "https://datasette.io/"
Traceback (most recent call last):
  File "D:\Program Files\anaconda3\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "D:\Program Files\anaconda3\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "D:\Program Files\anaconda3\Scripts\shot-scraper.exe\__main__.py", line 7, in <module>
    sys.exit(cli())
  File "D:\Program Files\anaconda3\lib\site-packages\click\core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "D:\Program Files\anaconda3\lib\site-packages\click\core.py", line 1053, in main 
    rv = self.invoke(ctx)
  File "D:\Program Files\anaconda3\lib\site-packages\click\core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "D:\Program Files\anaconda3\lib\site-packages\click\core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "D:\Program Files\anaconda3\lib\site-packages\click\core.py", line 754, in invoke

    return __callback(*args, **kwargs)
  File "D:\Program Files\anaconda3\lib\site-packages\shot_scraper\cli.py", line 515, in pdf
    url = url_or_file_path(url, _check_and_absolutize)
  File "D:\Program Files\anaconda3\lib\site-packages\shot_scraper\utils.py", line 27, in url_or_file_path
    file_path = file_exists(url)
  File "D:\Program Files\anaconda3\lib\site-packages\shot_scraper\cli.py", line 621, in _check_and_absolutize
    if path.exists():
  File "D:\Program Files\anaconda3\lib\pathlib.py", line 1388, in exists
    self.stat()
  File "D:\Program Files\anaconda3\lib\pathlib.py", line 1194, in stat
    return self._accessor.stat(self)
OSError: [WinError 123] 文件名、目录名或卷标语法不正确。: 'https:\\datasette.io'        

shopconan avatar May 20 '22 01:05 shopconan

Looks like this is a bug on Windows. Can anyone provide steps to reproduce and replicate in a fresh Windows development environment?

simonw avatar Jul 27 '22 22:07 simonw