Printf moved from Base in v1.4?

I decided to use basic commands like @sprintf without explicitly importing the module required. That is, instead of writing

using Printf
@sprintf("%.3f",0.4)

I wanted to write something like

Base.Printf.@sprintf("%.3f",0.4)

because I only use the function in three places and I wanted to keep the using statements for other modules in my code.

This worked in versions 1.1.1 through 1.3.1. When I tried this in v1.4, I got an error that Printf was not defined. Maybe this is because Printf might have been moved from Base and exported differently? I didn’t see anything in the release notes about this. If I’m right about this, then where is Printf and how can I access it without a using statement or is that impossible? Where would something like this be documented and I could read about it? Thanks!

1 Like

Printf is a standard library, not a submodule of Base. I’m surprised that Base.Printf ever worked in v1.x times.

Edit: apparently until v1.3 there was actually a submodule of Base called Printf :confused:

4 Likes

Hi,

I’m working in an air-gapped environment during the vid and am having version compatibility issues related to the issue above (the ODBC package I have installed uses an installed version of DecFP that calls Base.Printf, but I am using Julia 1.4). The person with permissions to install cannot come in here to downgrade julia or upgrade ODBC.

I am aware that the correct solution is to install the right versions. I cannot do that.

What is the second best solution here? I would like to run:

using Printf
Base.Printf = Printf

This doesn’t work, but if it did then ODBC would run without modification. can you recommend a similar hack/workaround?

Here’s a hack you can do:

julia> @eval Base using Printf

julia> Base.Printf
Printf
1 Like