Browsed by
Tag: software development

openpyxl’s “load_workbook” return empty list of sheets

openpyxl’s “load_workbook” return empty list of sheets

Consider this code: When using one of my xlsx-files as input, my code produced the output Sheet names: [] followed by this expection: After some investigating, I found that the file had been saved as “Strict Open XML Spreadsheet (xlsx)” instead of “Excel Workbook (xslx)”. Both files for some reason have the same file extension, but the former was not supported by the openpyxl library. Saving the file as “Excel Workbok (xslx)” got the code working again.

Adding “–version” parameter to “python3 setup.py”

Adding “–version” parameter to “python3 setup.py”

When building Python packages using setuptools, you typically manually set the upcoming package version in setup.py. For my use case, I found it better to provide the version number on the command line such as this: setuptools isn’t very fond of command line parameters, so I made a quick-n-dirty hack to work around this limitation:

SQLAlchemy + Database Link => ORA-04054

SQLAlchemy + Database Link => ORA-04054

I’ve got this SQLAclhemy table definition that describes a table I’ll be accessing over an Oracle database link: I first created a database link such as this: In SQLAlchemy, access a table column (in a query) via that link would look like tihs I turns out that SQLAlchemy with Oracle database links isn’t a very good match, and easily results in errors such as this: To work around this issue, I created a synonym like this: Now, accessing the table…

Read More Read More

Running Oracle in Docker for development and testing

Running Oracle in Docker for development and testing

I’m working on a Python based microservice that needs to communicate with an Oracle database. My development environment consist only of my laptop, so to do some real testing I decided to spin up Oracle in a Docker container on my laptop. For me, the process of getting things up and running wasn’t very straight forward for an Oracle newbie as myself, so I though I’d share my setup in case others may benefit from it. Let’s start with my…

Read More Read More

Spying on Python functions

Spying on Python functions

I was writing test code for a Python project, and needed to spy on the functions of one of the main object’s, called “server”, object instances called “rest_client”. By simply replacing the “rest_client” instance with a mock that passes the actual call to the wrapped object, I’m able to execute the production code of “rest_client” while later on making assertions.

Developing .NET applications without installing .NET SDK

Developing .NET applications without installing .NET SDK

I recently developed a small .NET application. I considered installing the .NET SDK on my laptop (on which I were to develop the .NET application), but was unsure of which version I would need, and how I would potentially downgrade the SDK version if needed.  Instead of installing the SDK on my laptop, I decided to run the SDK inside a Docker container. This way I could easily switch between SDK versions if needed, as all I’d have to do…

Read More Read More