Python Forum
Newbie Ubuntu script problem
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Newbie Ubuntu script problem
#1
I decided for my first Python project I would make a program that broke up a text file into individual passwords that would be attempted on a rar file until the solution was found. This is what I came up with:

#!/usr/bin/env python3

import os

with open("home/me/pwds","r") as a:
for lines in a:
for words in lines.split():
os.system("unrar x -y -p{} /home/me/documents/target.rar".format(words)

The prog.py was given execute permissions, and it throws this error when run as "sudo python prog.py":

File "program.py", line 12

^
Syntax error: invalid syntax


Any help appreciated.
Reply


Messages In This Thread
Newbie Ubuntu script problem - by Kloontor - Sep-24-2018, 01:56 AM
RE: Newbie Ubuntu script problem - by micseydel - Sep-24-2018, 03:25 AM
RE: Newbie Ubuntu script problem - by Kloontor - Sep-24-2018, 03:40 AM
RE: Newbie Ubuntu script problem - by Prabakaran141 - Sep-24-2018, 05:55 AM
RE: Newbie Ubuntu script problem - by snippsat - Sep-24-2018, 09:28 AM
RE: Newbie Ubuntu script problem - by Prabakaran141 - Sep-24-2018, 10:31 AM
RE: Newbie Ubuntu script problem - by Kloontor - Sep-24-2018, 03:51 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  very newbie problem on text file zapad 2 285 Apr-12-2024, 06:50 PM
Last Post: zapad
  Newbie first problem cima_hurdle 8 3,506 Feb-09-2022, 10:02 PM
Last Post: cima_hurdle
  Script stop work after 3 actioins - PLEASE WHERE IS THE PROBLEM? rondon442 0 1,588 Sep-27-2021, 05:40 PM
Last Post: rondon442
  Problem executing a script on a remote host tester_V 3 2,525 Sep-26-2021, 04:25 AM
Last Post: tester_V
  Python script in Ubuntu core Nithin_Kumar 1 3,404 May-11-2021, 01:14 AM
Last Post: Skaperen
  problem with sphinx and file directory in script kiyoshi7 0 2,315 Mar-11-2021, 03:52 PM
Last Post: kiyoshi7
  problem about slope in python script for bitcoin trading fisher_garry 1 2,537 Sep-02-2020, 01:39 PM
Last Post: fisher_garry
  Problem running script within console koepjo 3 9,948 Mar-26-2020, 07:11 AM
Last Post: koepjo
  Blender 2.49b not showing button when I run script on ubuntu like it does in windows? Vido 0 2,700 Dec-13-2019, 05:56 PM
Last Post: Vido
  Beginner problem in python script Cedmo 3 2,816 Jul-04-2019, 08:22 PM
Last Post: Cedmo

Forum Jump:

User Panel Messages

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