Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Does import require an internet connection?

It might be a stupid question, but so far I could not find an answer using Google.
Is an internet connection required to import libraries?
(Jan 8, 2019 10:37 AM)E V O Wrote:  It might be a stupid question, but so far I could not find an answer using Google.
Is an internet connection required to import libraries?

No, if you have already them otherwise you need something like pip or pip3 to download them before start coding and importing. (And yes pip requires internet connection)


https://pip.pypa.io/en/stable/


You can even simple download the module you need using the right path, but learning pip will save your time
If you have the libraries on your pc, no.
If you use pip to download them, yes.
(Jan 8, 2019 10:45 AM)FriendZone Wrote:  No, if you have already them otherwise you need something like pip or pip3 to download them before start coding and importing. (And yes pip requires internet connection)


https://pip.pypa.io/en/stable/


You can even simple download the module you need using the right path, but learning pip will save your time

Thank you for your reply. I have a programming exam tomorrow, where I will use a laptop with limited internet connection. A major part of the exam will contain operations on a data file (filetype unknown beforehand). Decoding a JSON file requires the use of the JSON library.
If there is no internet connection at all, I can rule out the possibility of a JSON file.

According to this all, this would mean there is an internet connection required to use import.json right? Or am I wrong since you do not need pip to import the json library

Thanks again!
(Jan 8, 2019 10:49 AM)E V O Wrote:  Thank you for your reply. I have a programming exam tomorrow, where I will use a laptop with limited internet connection. A major part of the exam will contain operations on a data file (filetype unknown beforehand). Decoding a JSON file requires the use of the JSON library.
If there is no internet connection at all, I can rule out the possibility of a JSON file.

According to this all, this would mean there is an internet connection required to use import.json right? Or am I wrong since you do not need pip to import the json library

Thanks again!
If the computer has the JSON library installed, you do not need internet. I highly doubt your test will require installing a library using PIP, it will likely already have the required libraries.

I think json comes with Python by default, anyway.

Je t'aime
[Image: fpZ5a5g.png]

(Apr 22, 2022 04:39 PM)-Scrub Wrote:  Jokes on you, I'm not smart enough to know what he's talking about.
(Jan 8, 2019 10:49 AM)E V O Wrote:  Thank you for your reply. I have a programming exam tomorrow, where I will use a laptop with limited internet connection. A major part of the exam will contain operations on a data file (filetype unknown beforehand). Decoding a JSON file requires the use of the JSON library.
If there is no internet connection at all, I can rule out the possibility of a JSON file.

According to this all, this would mean there is an internet connection required to use import.json right? Or am I wrong since you do not need pip to import the json library

Thanks again!

I think any useful library will be already in your machine. So you won’t need internet connection, also during exams you probably won’t be able to run any command in super user mode.

If I’m not enough clear: Pip install the library the first time, from this moment you will use the module or library just typing from library import Module or import library

For your particular case, json is a standard python module you won’t need to download it


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by john ronaldsadJul 20, 2022 06:49 PM 4 238 Jul 20, 2022 06:49 PM
Last Post: john ronaldsad
[Shell] by Emre_May 27, 2020 04:36 AM 0 105 May 27, 2020 04:36 AM
Last Post: Emre_
[Python] by Johan CruyffApr 4, 2020 08:15 AM 2 126 Apr 4, 2020 08:15 AM
Last Post: lnvisible