Python can't find 'main' module
72,665
It's because of the quote marks you are using. Change the “
s to "
s
Author by
sheetal_158
Updated on March 09, 2020Comments
-
sheetal_158 over 4 years
When I run the code using the command
python filename.py
, I am getting the following error,/Library/anaconda/bin/python: can't find '__main__' module in filename.py
I am not sure what exactly is going wrong here. I need help correcting this. How can I correct this?
SUFFIXES = {1000: ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], 1024: ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']} def approximate_size(size, a_kilobyte_is_1024_bytes=True): '''Convert a file size to human-readable form. Keyword arguments: size -- file size in bytes a_kilobyte_is_1024_bytes -- if True (default), use multiples of 1024 if False, use multiples of 1000 Returns: string ''' if size < 0: raise ValueError('number must be non-negative') multiple = 1024 if a_kilobyte_is_1024_bytes else 1000 for suffix in SUFFIXES[multiple]: size /= multiple if size < multiple: return '{0:.1f} {1}'.format(size, suffix) raise ValueError('number too large') if __name__ == “__main__”: print(“Hello World”) print(approximate_size(1000000000000, False)) print(approximate_size(1000000000000))
-
Sami Ahmed Siddiqui over 7 yearsLet this be a lesson not to copy paste from wordpress blogs.
-
user391339 about 4 yearswhat is the difference between
"
and"
? this did not solve the problem for me unfortunately. Also, I only see one double quotes on my keyboard. -
crookedleaf about 4 years@user391339 it's not
"
and"
, it's“
and“
.“
is a unicode character rather than ascii, and is not on a standard keyboard layout. please see compart.com/en/unicode/U+201C for more info. it is likely that you are having a different issue if this did not solve yours.