Python Forum
python keeps opening script directory
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python keeps opening script directory
#1
Could someone please help,

openwebsites.py:

import webbrowser
import os


def websites():
    websitelist = "Setup1\\web_value.txt"
    websites = []
    browser = webbrowser.get("windows-default")
    for line in open(websitelist, "r").readlines():
        websites.append(line.strip())
    for website in websites:
        browser.open(website)
websites()
This script opens a list of websites from a file that holds the urls. it works perfectly but it keeps opening the directory of openwebsites.py. What am I doing wrong?
Reply


Messages In This Thread
python keeps opening script directory - by Tyrel - Jul-27-2021, 06:47 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Is there a *.bat DOS batch script to *.py Python Script converter? pstein 3 3,256 Jun-29-2023, 11:57 AM
Last Post: gologica
  Running script with subprocess in another directory paul18fr 1 3,767 Jan-20-2023, 02:33 PM
Last Post: paul18fr
  Why is IDLE not opening on a MacOS Montery 12.6 and using Python 3.10.7? Merlin385 7 1,696 Oct-08-2022, 08:36 PM
Last Post: Merlin385
  Opening CMD from Python Oshadha 2 1,283 Jul-17-2022, 11:22 PM
Last Post: Skaperen
Question Opening small size browser with python selenium not work, need help greenpine 0 1,621 Feb-07-2022, 11:36 AM
Last Post: greenpine
  Python OpenCV window not opening in fullscreen mode Zman350x 0 3,305 Apr-29-2021, 07:54 PM
Last Post: Zman350x
  problem with sphinx and file directory in script kiyoshi7 0 2,289 Mar-11-2021, 03:52 PM
Last Post: kiyoshi7
  How to kill a bash script running as root from a python script? jc_lafleur 4 5,902 Jun-26-2020, 10:50 PM
Last Post: jc_lafleur
  Make the script read from any directory falahfakhri 2 2,166 Jun-15-2020, 02:18 PM
Last Post: falahfakhri
  crontab on RHEL7 not calling python script wrapped in shell script benthomson 1 2,296 May-28-2020, 05:27 PM
Last Post: micseydel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020