Python Forum
print() statement not executing..
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
print() statement not executing..
#1
Hi guys,

I am pretty new to program, I have written a program that copies files from one directory to other, issue is not in that. Issue is with the print statement, python not able to pick the print statement and execute it. Happy if solved


import sys
import os
import shutil

args = sys.argv[1:]
if not args:
  print("Type Destnination and source file")
  sys.exit(1)

Dest_dir = args[0]

Source_dir = args[1]

print("hello\n")

filenames = os.listdir(Source_dir)

def copy_to(abs_path,Dest_dir):
  if not os.path.exists(Dest_dir):
    os.mkdir(Dest_dir)

  shutil.copy(abs_path,Dest_dir)
  

for fname in filenames:
  file_path = os.path.join(Source_dir,fname)
  abs_path = os.path.abspath(file_path)
  copy_to(abs_path,Dest_dir)
  
Reply


Messages In This Thread
print() statement not executing.. - by bmohanraj91 - May-01-2017, 08:38 AM
RE: print() statement not executing.. - by buran - May-01-2017, 08:48 AM
RE: print() statement not executing.. - by Ofnuts - May-01-2017, 03:56 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Why doesn't this print statement work? stylingpat 10 5,863 Mar-23-2021, 07:54 PM
Last Post: buran
  Runs perfect in Python but fails to print last statement when converted to .exe. Help sunil422 3 2,870 Aug-13-2020, 01:22 PM
Last Post: deanhystad
  Taking brackets out of list in print statement pythonprogrammer 3 2,452 Apr-13-2020, 12:25 PM
Last Post: perfringo
  capture print statement written in Stored Procedure in SQL Server brijeshkumar_77 0 2,599 Feb-18-2020, 03:22 AM
Last Post: brijeshkumar_77
  printing a list contents without brackets in a print statement paracelx 1 2,165 Feb-15-2020, 02:15 AM
Last Post: Larz60+
  Embedding return in a print statement Tapster 3 2,334 Oct-07-2019, 03:10 PM
Last Post: Tapster
  Quotes and variables in print statement Mark17 4 3,109 Sep-13-2019, 04:07 PM
Last Post: Mark17
  Passing print output into another print statement Pleiades 6 3,214 Sep-08-2019, 02:37 PM
Last Post: Pleiades
  If statement won't print coreywratchford66 1 2,458 May-15-2019, 12:26 AM
Last Post: ichabod801
  if /else statement not executing correctly bluethundr 3 2,822 Apr-15-2019, 10:20 PM
Last Post: bluethundr

Forum Jump:

User Panel Messages

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