[Tutor] Help:python based framework show error
Hi dudes, I run the python based framework routersploit , it shows the following error. Traceback (most recent call last): File "./rsf.py", line 11, in routersploit() File "./rsf.py", line 7, in routersploit rsf = RoutersploitInterpreter() File "/home/tester/routersploit/routersploit/interpreter.py", line 155, in __init__ super(RoutersploitInterpreter, self).__init__() File "/home/tester/routersploit/routersploit/interpreter.py", line 25, in __init__ self.setup() File "/home/tester/routersploit/routersploit/interpreter.py", line 39, in setup readline.read_history_file(self.history_file) IOError: [Errno 13] Permission denied Thanks in Advance ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Help:python based framework show error
On Sat, Jul 02, 2016 at 10:34:27AM +0530, Palanikumar Gopalakrishnan wrote: > Hi dudes, > I run the python based framework routersploit , it shows > the following error. Thanks for sharing. Do you have a question? > Traceback (most recent call last): [...] > File "/home/tester/routersploit/routersploit/interpreter.py", line 39, in > setup > readline.read_history_file(self.history_file) > IOError: [Errno 13] Permission denied Have you read the error message? It seems pretty obvious to me: you don't have permission to read the history file. That's not a Python problem, it's a permissions problem: - check that you're reading the right file; - check that you're in the right directory; - check that you're running the code as the right user; - check that permissions on the file are right. Do you know how to do these things? -- Steve ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] dont understand part of a code
Hi, below is code for a hangman game which I copied from a book I am studying,Python programming for the absolute beginners by Michael Dawson. I have underlined the part of code I do not understand and why it is there. import random HANGMAN = ( """ --| | | | | - """, """ --| | 0 | | | - """, """ --| | 0 | -+- | | - """, """ --| | 0 |-+- | | - """, """ --| | 0 | /-+- | | - """, """ --| | 0 | /-+-\ | | - """, """ --| | 0 | /-+-\ | | | - """, """ --| | 0 | /-+-\ | | || - """, """ --| | 0 | /-+-\ | | || - """, """ --| | 0 | /-+-\ | | || | - """) MAX_WRONG = len(HANGMAN )-1 WORDS = ("PYTHON","RUBY","VISUAL BASIC","PHP","JAVA","UNIX","LINUX","PERL") word = random.choice(WORDS) so_far = "-" * len(word) wrong = 0 used = [] print("Welcome to hangman.Good luck!") while wrong < MAX_WRONG and so_far != word: print(HANGMAN[wrong]) print("\nYou've used the following letterss:\n",used) print("\nSo far,the word is:\n", so_far) guess = input("\nEnter your guess: ") guess = guess.upper() while guess in used: print("You've already guessed the letter",guess) guess = input("Enter your guess: ") guess = guess.upper() used.append(guess) if guess in word: print("\nYes",guess,"is in the word!") new = "" for i in range(len(word)): if guess == word[i]: new += guess * else:* *new += so_far[i] # why is there a else code here?* so_far = new else: print("\nSorry",guess,"isnt in the word") wrong += 1 if wrong == MAX_WRONG: print(HANGMAN[wrog]) print("\nYou have been hanged!!") else: print("\nYou have guessed correct") print("\nThe word was", word) input("\nPress enter to exit") ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] dont understand part of a code
On 02/07/16 11:46, Minhaj Ahmed via Tutor wrote: > have underlined the part of code I do not understand and why it is there. The mailing list is plain text so formatting like underline doesn't show up. Fortunately you added a comment too... > so_far = "-" * len(word) so_far is whats printed as the result so far. > used = [] used is the letters input so far > while wrong < MAX_WRONG and so_far != word: > print(HANGMAN[wrong]) > print("\nYou've used the following letterss:\n",used) > print("\nSo far,the word is:\n", so_far) > guess = input("\nEnter your guess: ") > guess = guess.upper() > > while guess in used: > print("You've already guessed the letter",guess) ... > if guess in word: > print("\nYes",guess,"is in the word!") > > new = "" > for i in range(len(word)): > if guess == word[i]: > new += guess > * else:* > *new += so_far[i] # why is there a else code here?* The else part is needed so that when the guess is noyt at the given position the current value of so_far is put into new. Lets assume the word is python lets assume sop_far contains o_ And you guess y On the first letter new should equal _ So because y is not the first letter the if clause is false so the else is selected and new[0] becomes so_far[0], ie '_' new = '_' Now on the next index i = 1 guess == word[1] is true so the if part executes setting new[1] to guess (ie to 'y') new now equals '_y' Now on the next index i = 2 guess == word[2] is false so the el;se gets selected setting new[2] to so_far[2] = '_' new now equals '_y_' and so on. new[i] either acquires the value of guess or so_far[i] (remember that guess may appear more than once...) > so_far = new Finally so_far is replaced with the final value of new. There are arguably easier ways of doing this using lists of characters rather than strings but this works. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] OT: Recommendations for a Linux distribution to dual-boot with Win7-64 bit
This is an update and a test to see if I have figured out Thunderbird's settings so that everything comes over as plain text instead of something else. If there are any issues let me know. Friday the Mint crew announced that they were releasing their new version of Mint, version 18, Sarah, so I went _bleeding edge_ and tried to install it. Things did not go well in the sense that I was not able to make a dual-boot installation where Windows 7 was on its existing hard drive and Mint 18 on its own. As far as I can tell I did everything correctly, but upon rebooting there was no option to go to Mint; instead, the boot went directly to Windows 7. After many hours of effort, searching, etc. (It was after 6 AM local time when I gave up.) I decided to simply unplug the Windows 7 hard drive and plug my new hard drive in its place. I successfully installed Mint 18 and it booted up fine with one quirk. My understanding is that I would be prompted to remove my installation USB drive prior to it rebooting, but it didn't and this seemed to cause issues. On my repeat installation effort I removed the USB drive myself when it appeared that the system had just shut down. Things have gone well since. I guess I will save the dual-boot effort for some other day. Now I am updating things, playing with Firefox and Thunderbird, etc. On the latter I was surprised that Thunderbird did not support conversation views out of the box. I am currently testing an extension, "Thunderbird Conversations", which is a bit different in what I was expecting (Compared to Gmail.), but I suppose I will get used to it. We will see how the Linux experiment will work! My plan is to work my way through the book, "How Linux Works", by Brian Ward. So that will probably distract me from Python studies for a while. Again, thanks for all of the help you've collectively given! boB ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor