title: Running Python script from desktop
body: <p>I have installed Anaconda on my PC, and I've also added Anaconda to path. I've made a script which works fine in Jupyter, and it also works fine when I call it from the Anaconda Prompt terminal. However, when I try to execute it as a Python script from my desktop, nothing happens. I don't even get an output, so I can see what's going wrong. This is the script:</p>
  <pre><code>from bs4 import BeautifulSoup
  import requests
  import re
  import urllib.request
  import os
  from tkinter import *
  from PIL import Image, ImageTk
  import tkinter as tk
  from tkinter import Tk, Menu, Canvas
  import datetime
  from pathlib import Path
  
  url = requests.get(&quot;https://politiken.dk/underholdning/wulffmorgenthaler/&quot;)
  html = url.text
  soup = BeautifulSoup(html,'lxml')
  main = soup.find_all(&quot;a&quot;, attrs={&quot;data-prefetchable&quot;:&quot;true&quot;})
  
  list_of_links = []
  for i in main:
      list_of_links.append(re.findall(r'(https://politiken.dk/underholdning/wulffmorgenthaler/.{1,34}(?=&quot;))', str(i))[0])
  
  list_of_links = list(dict.fromkeys(list_of_links))
  
  counter = 0
  
  def next_day():
      global counter
      counter += 1
      today = datetime.date.today()
      date = today - datetime.timedelta(days=counter)
      final_date = date.strftime(&quot;%m%d&quot;)
      image_downloader(final_date)
      
  def prev_day():
      global counter
      if counter == 0:
          pass
      else:
          counter -= 1
          today = datetime.date.today()
          date = today - datetime.timedelta(days=counter)
          final_date = date.strftime(&quot;%m%d&quot;)
          image_downloader(final_date)
  
  def image_downloader(date_numbers):
      global counter
      
      my_file = Path(fr&quot;C:\Users\Peter\Desktop\Wolfmorgenthaler/{date_numbers}.jpg&quot;)
      if my_file.exists():
          open_img(date_numbers)
          
      elif counter&lt;len(list_of_links):
          new_url = requests.get(list_of_links[counter])
          new_html = new_url.text
          new_soup = BeautifulSoup(new_html,'html')
          new_main = new_soup.find_all(&quot;img&quot;, attrs={&quot;class&quot;:&quot;media__image image--fullwidth&quot;})
          new_picture_links = re.findall(r'https.+? ', str(new_main[0]))
          final_link = new_picture_links[0]
          
          fullfilename = os.path.join(r&quot;C:\Users\Peter\Desktop\Wolfmorgenthaler&quot;, f&quot;{date_numbers}.jpg&quot;)
          urllib.request.urlretrieve(final_link, fullfilename)
  
          open_img(date_numbers)
      
      else:
          counter = counter - 1
  
  def open_img(name):
      filepath = fr&quot;C:\Users\Peter\Desktop\Wolfmorgenthaler/{name}.jpg&quot;
      img = Image.open(filepath)
      img = img.resize((960, 449), Image.ANTIALIAS)
      img = ImageTk.PhotoImage(img)
      panel = Label(root, image=img)
      panel.image = img
      panel.grid(row = 1, columnspan=4)
  
  root = Tk()
  
  root.geometry(&quot;964x483&quot;)
  root.resizable(width=True, height=True)
  
  today = datetime.date.today()
  date = today - datetime.timedelta(days=counter)
  final_date = date.strftime(&quot;%m%d&quot;)
  
  image_downloader(final_date)
      
  btn1 = Button(root, text='Næste billede', command=next_day, width = 67).grid(row = 2, column = 2)
  btn2 = Button(root, text='Forrige billede', command=prev_day, width = 67).grid(row = 2, column = 1)
      
  root.mainloop()
  
  </code></pre>
  <p>I just reset my PC today, and it worked just fine before I reset it. I have no idea how to get it to work. I would like to just have it be a clickable icon on my desktop, which executes the script.</p>
  <p>Executing it with a batch file did not work either. Any ideas?</p>