Python Forum
Problem importing resource library
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem importing resource library
#1
Hopefully someone can help me...

I've used pip to install the resource library;

pip install resource
Collecting resource
Using cached https://files.pythonhosted.org/packages/...ne-any.whl
Requirement already satisfied: python-easyconfig>=0.1.0 in c:\python27\arcgis10.5\lib\site-packages (from resource) (0.1.7)
Requirement already satisfied: JsonSir>=0.0.2 in c:\python27\arcgis10.5\lib\site-packages (from resource) (0.0.2)
Requirement already satisfied: JsonForm>=0.0.2 in c:\python27\arcgis10.5\lib\site-packages (from resource) (0.0.2)
Requirement already satisfied: PyYAML in c:\python27\arcgis10.5\lib\site-packages (from python-easyconfig>=0.1.0->resource) (5.1.2)
Requirement already satisfied: six in c:\python27\arcgis10.5\lib\site-packages (from python-easyconfig>=0.1.0->resource) (1.10.0)
Requirement already satisfied: jsonschema in c:\python27\arcgis10.5\lib\site-packages (from JsonForm>=0.0.2->resource) (3.1.1)
Requirement already satisfied: importlib-metadata in c:\python27\arcgis10.5\lib\site-packages (from jsonschema->JsonForm>=0.0.2->resource) (0.23)
Requirement already satisfied: setuptools in c:\python27\arcgis10.5\lib\site-packages (from jsonschema->JsonForm>=0.0.2->resource) (28.8.0)
Requirement already satisfied: attrs>=17.4.0 in c:\python27\arcgis10.5\lib\site-packages (from jsonschema->JsonForm>=0.0.2->resource) (19.3.0)
Requirement already satisfied: functools32; python_version < "3" in c:\python27\arcgis10.5\lib\site-packages (from jsonschema->JsonForm>=0.0.2->resource) (3.2.3.post2)
Requirement already satisfied: pyrsistent>=0.14.0 in c:\python27\arcgis10.5\lib\site-packages (from jsonschema->JsonForm>=0.0.2->resource) (0.15.4)
Requirement already satisfied: configparser>=3.5; python_version < "3" in c:\python27\arcgis10.5\lib\site-packages (from importlib-metadata->jsonschema->JsonForm>=0.0.2->resource) (4.0.2)
Requirement already satisfied: contextlib2; python_version < "3" in c:\python27\arcgis10.5\lib\site-packages (from importlib-metadata->jsonschema->JsonForm>=0.0.2->resource) (0.6.0.post1)
Requirement already satisfied: pathlib2; python_version == "3.4.*" or python_version < "3" in c:\python27\arcgis10.5\lib\site-packages (from importlib-metadata->jsonschema->JsonForm>=0.0.2->resource) (2.3.5)
Requirement already satisfied: zipp>=0.5 in c:\python27\arcgis10.5\lib\site-packages (from importlib-metadata->jsonschema->JsonForm>=0.0.2->resource) (0.6.0)
Requirement already satisfied: scandir; python_version < "3.5" in c:\python27\arcgis10.5\lib\site-packages (from pathlib2; python_version == "3.4.*" or python_version < "3"->importlib-metadata->jsonschema->JsonForm>=0.0.2->resource) (1.10.0)
Requirement already satisfied: more-itertools in c:\python27\arcgis10.5\lib\site-packages (from zipp>=0.5->importlib-metadata->jsonschema->JsonForm>=0.0.2->resource) (5.0.0)
Installing collected packages: resource
Successfully installed resource-0.2.1

The install reports as successful!!!

When I run the following code (i.e. import the library within a try loop) I get the message "No module named resource";

try:
    import resource
except Exception, e:
    print str(e)
    booContinue = 0
Please note that I'm using Python 2.7 due to compatibility with third party libaries.
Thanks
Reply
#2
can you post the pypi link for the module?
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
(Oct-23-2019, 12:20 PM)buran Wrote: can you post the pypi link for the module?
Sorry, I don't know how to do that :-(
Reply
#4
I try to understand what module you try to install
I find these as closest
https://pypi.org/project/Resource/
https://pypi.org/project/resources/
https://pypi.org/project/python-resources/

but maybe it's something else. what module you try to install? Am I right it's the first one?
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#5
I need some tools to help monitor \ restrict CPU usage! I found some nice samples which import resource!
Reply
#6
Oh, In this case I guess they use module from Python standard library https://docs.python.org/3/library/resource.html
however it's only available on Unix systems, not Windows
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#7
(Oct-23-2019, 01:24 PM)buran Wrote: Oh, In this case I guess they use module from Python standard library https://docs.python.org/3/library/resource.html
however it's only available on Unix systems, not Windows

I guess that is why I can't import it! Do you know if there are any Windows libabries out there, that will enable me to set a max CPU usage within a script?
Reply
#8
you may want to take a look at https://github.com/giampaolo/psutil
but not sure if it fit your needs. maybe someone else could suggest another package
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#9
(Oct-23-2019, 01:32 PM)buran Wrote: you may want to take a look at https://github.com/giampaolo/psutil
but not sure if it fit your needs. maybe someone else could suggest another package

Many thanks, I'll do that.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  cinemagoer library problem lunacy90 21 2,367 Sep-08-2023, 04:30 PM
Last Post: menator01
  python standard way of importing library mg24 1 891 Nov-15-2022, 01:41 AM
Last Post: deanhystad
  Problem with importing python-telegram library into the project gandonio 1 1,562 Nov-01-2022, 02:19 AM
Last Post: deanhystad
  Problem with importing Python file in Visual Studio Code DXav 7 5,064 Jun-15-2022, 12:54 PM
Last Post: snippsat
  How to set CPU and memory resource SriRajesh 1 1,458 Aug-16-2021, 05:23 PM
Last Post: Larz60+
  importing same python library in multiple custom module escape_freedom13 6 3,791 May-10-2020, 07:01 PM
Last Post: escape_freedom13
  Problem with using Crypto library reks2004 2 2,411 Mar-27-2020, 05:38 AM
Last Post: buran
  Problem installing library thunderspeed 2 2,321 Mar-22-2020, 11:04 PM
Last Post: thunderspeed
  Please help: problem installing/importing langdetect module in Jupyter Notebook ledgreve 3 7,264 Dec-30-2019, 08:17 AM
Last Post: LeanbridgeTech
  Problem with importing and using collections module pythomdummy 3 5,792 Nov-14-2019, 08:48 AM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020