Python import library error
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Dear Alteryx Community,
I have a pyhton code that's run correctly from jupter.
However when I try to excute the code throw Python component it display the error
ModuleNotFoundError Traceback (most recent call last)
It's because I can't import the library
import openpyxl
I tried Package.installPackages(['openpyxl']) same error
My code is used to connect to an excel workbook and extract each sheet in new a workbook that work fine outside Alteryx.
import openpyxl
from openpyxl import load_workbook, Workbook
wb = openpyxl.load_workbook(r"My workbook")
for sheet in wb.worksheets:
new_wb = Workbook()
ws = new_wb.active
for row_data in sheet.iter_rows():
for row_cell in row_data:
ws[row_cell.coordinate].value = row_cell.value
Racine=("My destination")
new_wb.save('{0}.xlsx'.format(Racine+sheet.title))
Many thanks in advance for help,
Regards,
Solved! Go to Solution.
- Labels:
- Python
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I think you have to run Alteryx in Admin mode to import the Python libraries. Right click on the Alteryx icon and choose Run as administrator.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi,
I am getting the same error. I am running the packages in trail version of Alteryx does that create issue? I executed Alteryx as administrator still the issue exists.
