Есть ли вообще разница?

У меня есть код:

import telebot
from random import randint, choice
from os import path, mkdir, listdir

bot = telebot.TeleBot("token")

@bot.message_handler(content_types='text')
def rand_photo(message):
    def photos(dir):
        list_photo = listdir(f'photos/{dir}')
        list_photo = [f'photos/{dir}/{el}' for el in list_photo]
        random_address = choice(list_photo)
        with open(random_address, 'rb') as fl:
            photo = fl.read()
        bot.send_photo(message.chat.id, photo)
    user_text = 'image'
    user_text_1 = 'nature'
    user_text_2 = 'people'
    user_text_3 = 'space'
    if user_text_1 in message.text:
        if user_text in message.text:
            photos('nature')
    elif user_text_2 in message.text:
        if user_text in message.text:
            photos('people')
    elif user_text_3 in message.text:
        if user_text in message.text:
            photos('space')

bot.polling()

вот тут вот:

list_photo = listdir(f'photos/{dir}')
list_photo = [f'photos/{dir}/{el}' for el in list_photo]

в pycharm все работает, но в vscode только тогда когда есть полный путь к файлу. Как исправить?


Ответы (0 шт):