Python Forum
Program gives error but doesn't say where the error is.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Program gives error but doesn't say where the error is.
#4
(Mar-08-2019, 09:21 PM)ichabod801 Wrote: You are going to have to be more specific about how you are testing it. It works fine when I run it. That doesn't look like an error, it looks like the repr for an instance of w_encryption. My guess is your test is returning the encryption object when it should be returning the encrypted text.

Edit: for example:

Output:
>>> test = w_encryption('Avalokiteshvara') >>> test._encrypt_() '14061962245146643241220108292105138248193963515807825' >>> test <__main__.w_encryption instance at 0x0000000003988548>

Thanks for your response!

I was doing:
test = w_encryption('hello')
test._encrypt_()
print(test)
Haha that's why I got "<__main__.w_encryption instance at 0x0000000003988548>" in response.

(Mar-09-2019, 01:22 AM)woooee Wrote: You can save yourself a whole lot of lines of code by using a dictionary
encr_dict={'a':(1, 50)
           'b':(300, 400)}
if echar in encr_dict:
    echar = randint(encr_dict(echar))
    self.encrypted.append(echar)


## etc
## replaces 
            if character == 'a':
                echar = randint(1, 50)
                self.encrypted.append(echar)
            elif character == 'b':
                echar = randint(300, 400)
                self.encrypted.append(echar)  
Finally, how are you going to decode it since you don't know which random number was used to encode it?

Thanks for your response!
But I already wrote the code for 80+ characters. Haha
Reply


Messages In This Thread
RE: Program gives error but doesn't say where the error is. - by FWendeburg - Mar-09-2019, 11:42 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  pandas.errors.ParserError: Error tokenizing data. C error: Expected 9 fields in line Anldra12 9 15,371 Jun-15-2021, 08:16 AM
Last Post: Anldra12
  I have an index error inline 76 but I write the program in a way that cant reach tha abbaszandi 2 2,074 Nov-13-2020, 07:43 AM
Last Post: buran
  cx_Oracle.DatabaseError: Error while trying to retrieve text from error ORA-01804 rajeshparadker 0 8,647 Nov-12-2020, 07:34 PM
Last Post: rajeshparadker
  Coding error- Not sure where I have put error markers against the code that is wrong Username9 1 1,739 Sep-28-2020, 07:57 AM
Last Post: buran
  Type Error or Value Error? spalisetty06 3 2,398 Jul-21-2020, 04:56 AM
Last Post: deanhystad
  Try-except in while loop: error with closing program Lupin_III 7 2,891 Jul-03-2020, 10:57 AM
Last Post: Lupin_III
  program error Dalpi 4 2,485 Apr-30-2020, 11:46 PM
Last Post: Dalpi
  Error in Python3.6:free() Corrupted unsorted chunks error sameer_k 2 3,874 Mar-18-2020, 09:37 AM
Last Post: sameer_k
  ERROR:haproxystats:Error fetching stats deepakkr3110 1 2,034 Nov-12-2019, 12:29 PM
Last Post: Larz60+
  Error :unable to detect undefined names created in spyder ide error at line 2 milind_eac 2 8,290 Jul-30-2019, 10:29 PM
Last Post: milind_eac

Forum Jump:

User Panel Messages

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