openpyxl\__init__.py", line 27 ..... SyntaxError: unexpected EOF while parsing

99 views
Skip to first unread message

Jose Brito

unread,
Feb 21, 2021, 8:44:17 PM2/21/21
to openpyxl-users
excell 2016 ... I've installed it several times and always give me this error when installing openpyxl. what can I do????

Charlie Clark

unread,
Feb 22, 2021, 6:10:33 AM2/22/21
to openpyxl-users

On 22 Feb 2021, at 2:44, Jose Brito wrote:

excell 2016 ... I've installed it several times and always give me this
error when installing openpyxl. what can I do????

I've no idea what you're doing but it must be something wrong because openpyxl/init.py is only 19 lines long. I assume you haven't installed openpyxl according to the documentation.

Good luck!

Charlie Clark

--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Kronenstr. 27a
Düsseldorf
D- 40217
Tel: +49-211-600-3657
Mobile: +49-178-782-6226

Jose Brito

unread,
Feb 22, 2021, 9:29:58 AM2/22/21
to openpyx...@googlegroups.com
# Copyright (c) 2010-2021 openpyxl
"""
#from openpyxl.compat.numbers import NUMPY
from openpyxl.xml import DEFUSEDXML, LXML
from openpyxl.workbook import Workbook
from openpyxl.reader.excel import load_workbook as open
from openpyxl.reader.excel import load_workbook
import openpyxl._constants as constants
"""
import openpyxl

wb = openpyxl.load.workbook(filename = "pytttt.xlsx")
wb.shetnames
for d in wb['sheet_1'].iter_rows(values_only = True):
print (d)

# Expose constants especially the version number

__author__ = constants.__author__
__author_email__ = constants.__author_email__
__license__ = constants.__license__
__maintainer_email__ = constants.__maintainer_email__
__url__ = constants.__url__
__version__ = constants.__version__
my program
import openpyxl

wb = openpyxl.load.workbook(filename = "pytttt.xlsx")
wb.shetnames
for d in wb['sheet_1'].iter_rows(values_only = True):
    print (d)
the error
Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec  7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>>
== RESTART: C:\Users\José Brito\AppData\Local\Programs\Python\Python39\bex.py ==
Traceback (most recent call last):
  File "C:\Users\José Brito\AppData\Local\Programs\Python\Python39\bex.py", line 1, in <module>
    import openpyxl
  File "C:\Users\José Brito\AppData\Local\Programs\Python\Python39\lib\site-packages\openpyxl\__init__.py", line 27
   
    ^
SyntaxError: unexpected EOF while parsing
>>>

--
You received this message because you are subscribed to the Google Groups "openpyxl-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openpyxl-user...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/openpyxl-users/F0E2AB45-327F-4AC3-8586-5D626ECA5F02%40clark-consulting.eu.

Charlie Clark

unread,
Feb 22, 2021, 9:32:46 AM2/22/21
to openpyx...@googlegroups.com
On 22 Feb 2021, at 15:29, Jose Brito wrote:

> line 27
>
> ^
> SyntaxError: unexpected EOF while parsing

Yep, count the lines. Sorry, it's something on your system that you'll
have to debug and fix, not least because I only occasionally have access
to a Windows system. You might get lucky by uninstalling openpyxl and
trying again. Otherwise you could try a virtualenv, which I would always
recommend for development work anyway.

Charlie

Jose Brito

unread,
Feb 22, 2021, 10:00:29 AM2/22/21
to openpyx...@googlegroups.com
Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec  7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>>
== RESTART: C:\Users\José Brito\AppData\Local\Programs\Python\Python39\bex.py ==
Traceback (most recent call last):
  File "C:\Users\José Brito\AppData\Local\Programs\Python\Python39\bex.py", line 3, in <module>

    wb = openpyxl.load.workbook(filename = "pytttt.xlsx")
AttributeError: module 'openpyxl' has no attribute 'load'
>>>


I uninstalled it afterwards in scripts I did pip install and now it gives this error ??? was there something to install ??? please can you send me the TAR installation file to see if i can install correctly ??? thanks 

--
You received this message because you are subscribed to the Google Groups "openpyxl-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openpyxl-user...@googlegroups.com.

Charlie Clark

unread,
Feb 22, 2021, 10:05:25 AM2/22/21
to openpyx...@googlegroups.com
On 22 Feb 2021, at 16:00, Jose Brito wrote:

> I uninstalled it afterwards in scripts I did pip install and now it
> gives
> this error ??? was there something to install ??? please can you send
> me
> the TAR installation file to see if i can install correctly ??? thanks

Well, it would help if typed the correction function name…

from openpyxl import load_workbook

Charlie

PS. it also looks like you're storing your scripts directly in your
Python instal. I'd advise against that: always use project folders.
Reply all
Reply to author
Forward
0 new messages