Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Indentation
#11
there could be some control character in the file that isn't copied when you post it. could be the post web form ignores it. you copied the code from the post to a different file? compare them or check file size. maybe that will show. if one files works and the other does not, then they can't be identical.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#12
You can print the detailed file's contents with
Output:
python3 -c "print(repr(open('filename.py').read()))"
or the binary version
Output:
python3 -c "print(repr(open('filename.py', 'rb').read()))"
Reply
#13
and I get
Error:
C:\Python36\kodovi>python3 -c "(repr(open('randfun.py').read()))" 'python3' is not recognized as an internal or external command, operable program or batch file.
Reply
#14
Use python or py or whatever command launches the python interpreter in your OS.
Reply
#15
it gives me the result with python command but it's really hard for me to read it. I simply give up on this problem, no need to lose time on it anymore.
Reply
#16
i can understand this. a past development manager i worked for long,long ago always wanted input to decide on a finite time for solving problems that a bypass existed for. so in the daily meeting, after bringing up an issue, we would discuss (with a 20 minute limit on this) how much time was worth committing to working on (usually researching) a raised issue. he firmly believed that no issue should ever have time overspent on it by the team or any individual.

we already know that development time is precious and should be used optimally. OTOH, we are curious what caused this. and it is the kind of thing many of us know how to resolve in just a few minutes at the keyboard. sure, we now know exactly how to make this go away. do we need to do any more?

i suggest that if something like this happens, again, put the file in question in a .ZIP file and post that for download somewhere. surely, everyone can make a .ZIP file.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#17
Hello!

May I ask why such an indentation is there with almost every code editor including python IDE, sublime text, PyScripter, visual studio codes, Pycharm...! This is happening everywhere with many python programmers,not only with me....

Me think, is there any possibility that the computer might have carried some kinds of malwares or spywares that could affect the code editor softwares, that the computer could not be able to accurately acquire exactly indentation spaces that is needed to initiate python codes...is it possible?

As to Reference the lase codes I have been working with as when I have got this very odd conclusion lol :D:

from tkinter import *
import tkinter.messagebox
import sqlite3 as db

class Product(Tk):
	def __init__(self):
		super(Product, self).__init__()

		self.geometry("1000x600+150+50")
		self.wm_title('Product Window')
		self.wm_iconbitmap('myicon.ico')

    def createtable(self):
 		conn=db.connect('deepak.db')
		cur=conn.cursor()
		cur.execute('''CREATE TABLE IF NOT EXISTS data
					( sidTEXT,
					nameTEXT,
					fathernameTEXT,
					mothernameTEXT,
					genderTEXT,
					mobileTEXT,
					addressTEXT
					)''')

		conn.commit()
		cur.close()
		print("Database is created Successfully........")

root= Product()
root.mainloop()
The error was message was:

Error:
File "C:\Users\asus\Documents\python\test1.py", line 15 def createtable(self): ^ IndentationError: unindent does not match any outer indentation level [Finished in 0.4s]
Reply


Forum Jump:

User Panel Messages

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