'Why is Python running a different script?

I'm in Windows and I have a script called csv.py, I recently installed Pandas, and created anotherscript.py. The only code I have under anotherscript.py is import pandas.

When I run py anotherscript.py all it is doing is running csv.py. I have renamed csv.py to something else and it is still getting called.

If I removed import pandas, it works. If I move anotherscript.py to a different folder it works fine. It looks like something is cached.

What am I missing???

anotherscript.py

import pandas

cmd call and output

C:\Users\*****>py anotherscript.py
0 634
1 Saturday, January  8, 2022
2 15:00 EST
.
.
.
<cal file created and uploaded>

csv.py

This script scrapes a webpage and creates a calendar file

import openpyxl
from openpyxl import load_workbook
from ics import Calendar, Event
from datetime import datetime
import pytz
from ftplib import FTP
import ftplib
import urllib.request
import requests


response = requests.post("urlRetrated")
with open('u7.xlsx', 'wb') as s:
    s.write(response.content)

wb_obj = openpyxl.load_workbook('u7.xlsx') 
worksheet = wb_obj.active
data = []
c = Calendar()
EST = pytz.timezone('US/Eastern')


for count, row_cells in enumerate(worksheet.iter_rows(min_row=2,values_only=True)):
    for count, cell in enumerate(row_cells):
        data.append(cell)
        
    date_and_time = data[1] + " " + data[2].strip('EST ')
    game_datetime = datetime.strptime(date_and_time, '%A, %B %d, %Y  %H:%M')
    
    if 'SoccerTeam' in data[3]:
        data[3] = 'William'
    
    if 'SoccerTeam' in data[5]:
        data[5] = 'William'
    
    game_title  = data[3] + " Vs " + data[5]
    game_location = data[6]
    
    e = Event()
    e.name = game_title
    e.begin = game_datetime.replace(tzinfo=EST)
    e.location = game_location  
    e.created = datetime.today()
    c.events.add(e)
    with open('marcos.ics', 'w', newline='') as f:
        f.write(str(c))
        f.close()   
        
        
    for index, value in enumerate(data):
        print(index, value)
    data = []
        

user = '****'
pas = '*****'

try:
    ftp = ftplib.FTP('*****', user, pas)
    print(ftp.getwelcome())
    ftp.cwd('public_html')
    file = open('will.ics','rb')
    ftp.storbinary('STOR will.ics', file)
    file.close()
    ftp.quit()
except ftplib.error_perm as error:
    if error:
        print ('Login Failed')

Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source