nonchris / discord-bot

Generic bot to start with based on discord.py
14 stars 4 forks source link

Running setup produces ValueError: path 'src/' cannot end with '/'" #3

Closed swooboo closed 1 year ago

swooboo commented 2 years ago

First of all, thanks for the great work you did on this bot. The learning curve is very nice, and the code is high quality to my taste.

Running PyCharm on Windows 10 Home, imported my new project from your great template through the GitHub plugin.

It offers to create a VEnv: image

Which produces the following error: image

Full log dump:

Obtaining file:///D:/artist-bot-reproduce
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'

  ERROR: Command errored out with exit status 1:
   command: 'D:\artist-bot-reproduce\.venv\Scripts\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'D:\\artist-bot-reproduce\\setup.py'"'"'; __file__='"'"'D:\\artist-bot-reproduce\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\sergey\AppData\Local\Temp\pip-pip-egg-info-h5dh40jv'
       cwd: D:\artist-bot-reproduce\
  Complete output (9 lines):
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "D:\artist-bot-reproduce\setup.py", line 52, in <module>
      packages=find_packages(where='src/'),
    File "D:\artist-bot-reproduce\.venv\lib\site-packages\setuptools\__init__.py", line 65, in find
      convert_path(where),
    File "D:\artist-bot-reproduce\.venv\lib\site-packages\setuptools\_distutils\util.py", line 182, in convert_path
      raise ValueError("path '%s' cannot end with '/'" % pathname)
  ValueError: path 'src/' cannot end with '/'
  ----------------------------------------
WARNING: Discarding file:///D:/artist-bot-reproduce. Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 21.3.1; however, version 22.2 is available.
You should consider upgrading via the 'D:\artist-bot-reproduce\.venv\Scripts\python.exe -m pip install --upgrade pip' command.

Subsequent running of python -m pip install -e . (not python3 because it's venv) produces the same error:

(.venv) PS D:\artist-bot-reproduce> python -m pip install -e .
Obtaining file:///D:/artist-bot-reproduce
  Preparing metadata (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'D:\artist-bot-reproduce\.venv\Scripts\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'D:\\artist-bot-reproduce\\setup.py'"'"'; __file__='"'"'D:\\artist-bot-reproduce
\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'
"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\sergey\AppData\Local\Temp\pip-pip-egg-info-syh3zbi6'
       cwd: D:\artist-bot-reproduce\
  Complete output (9 lines):
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "D:\artist-bot-reproduce\setup.py", line 52, in <module>
      packages=find_packages(where='src/'),
    File "D:\artist-bot-reproduce\.venv\lib\site-packages\setuptools\__init__.py", line 65, in find
      convert_path(where),
    File "D:\artist-bot-reproduce\.venv\lib\site-packages\setuptools\_distutils\util.py", line 182, in convert_path
      raise ValueError("path '%s' cannot end with '/'" % pathname)
  ValueError: path 'src/' cannot end with '/'
  ----------------------------------------
WARNING: Discarding file:///D:/artist-bot-reproduce. Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 21.3.1; however, version 22.2 is available.
You should consider upgrading via the 'D:\artist-bot-reproduce\.venv\Scripts\python.exe -m pip install --upgrade pip' command.
(.venv) PS D:\artist-bot-reproduce>

I'm not entirely sure this is the correct fix, but removing the / from src/ in the two lines below fixed the issue for me. Maybe under other OS'es it won't work.

https://github.com/nonchris/discord-bot/blob/c78f23421965ef2b2d2329994731e58c9d609275/setup.py#L50-L52

nonchris commented 2 years ago

Hey, thanks for the feedback,
I'm very pleased to hear that you like my template!
Please excuse my long reply-time I had to focus on my exams.

Hm. I never saw this error before.
But I'm only using linux and MacOS. So maybe it's a problem you only face using Windows.
I'll try you fix using my systems and remove the / if this doesn't cause any further problems.
Thanks for finding a potential fix and taking the time to suggest it here!

nonchris commented 2 years ago

Fixed: https://github.com/nonchris/discord-bot/commit/fb6b40640098fcc8cd7c211cf31158cee1073905

swooboo commented 1 year ago

It's so cool that it got fixed! My reply is even longer, sorry about that.