Home > Back-end >  VS terminal just outputting two directories?
VS terminal just outputting two directories?

Time:04-24

I am writing a small script to create an Excel workbook with new sheets. But every time I try and run it the terminal window opens and just shows:

& "C:/Program Files/Python39/python.exe" "c:/Users/Jerome/Desktop/VS Code Projects/Python/Excel workbook/excel_sheet.py"

I am not sure what this means?

import xlwt
from xlwt import Workbook

# This creates the workbook
wb = Workbook()

# the add_sheet() method is used to create a sheet
sheet1 = wb.add_sheet('Sheet 1')

sheet1.write(1, 0, "Chris Smith")

# this saves the workbook
wb.save('new-sheet.xlsx')

CodePudding user response:

It is not an error. It is a command that runs your code with python interpreter. For example if you put a print('end') at the end of your code you can see the print result after this line.

I assume you run the code by clicking on the top right run button in vscode or some other editors. They write this command in the terminal to run your code with python. It is not an error.

"C:/Program Files/Python39/python.exe" this part is the path to python exe file. and "c:/Users/Jerome/Desktop/VS Code Projects/Python/Excel workbook/excel_sheet.py" is the path to the file of your code.

When you run this code open the folder your code exists in. You have to see a new file named new-sheet.xlsx been created. (also I ran your code everything is ok).

If you have any questions please ask.

  • Related