PyPI Module not working - python

So today i started working on a simple python module, but i cant make it work.
the module itself works, but when i have uploaded it to PyPI and i then install it using Pip, it wont work.
Please notice that it is built for python-2.7
The source code can be seen here:
https://github.com/1m0r74l17y/FortyTwo
and it can be downloaded using:
sudo pip install FortyTwo
whenever i try to run a test program like this:
from FortyTwo import *
FortyTwo.nope()
It just gives me an error:
Traceback (most recent call last):
File "test.py", line 3, in
FortyTwo.nope()
AttributeError: 'module' object has no attribute 'fortytwo'
I would really appreciate any help, as it might lead me onto what i have to do to fix the problem.

You would need to do the following.
from FortyTwo import fortytwo
fortytwo.nope()
If you want to call nope directly from FortyTwo you would need to import that function in __init__.py.
e.g.
from FortyTwo.fortytwo import nope
def Start():
"""No Clue what to add here"""

What if you do
from FortyTwo import fortytwo
fortytwo.nope()
* credits to eandersson.

Related

Error: No module named 'pymem.process'; 'pymem' is not a package

I am trying to learn how to use pymem in Python.
I have tried to make two different programs according to two tutorials I have seen but I always get the same error when I try to run the code.
I have this:
from pymem import Pymem
pm = pymem("ac_client.exe")
health = pm.read_int(0x007B43F4)
print ("Health: ", health)
But when I try to run the code I get the following error:
Traceback (most recent call last):
File "c:\Users\N\Desktop\PYTHON\pymem\pymem2.py", line 1, in <module>
from pymem import Pymem
File "c:\Users\N\Desktop\PYTHON\pymem\pymem.py", line 4, in <module>
from pymem.process import *
ModuleNotFoundError: No module named 'pymem.process'; 'pymem' is not a package
I have pymem installed in it's latest version from Visual Studio Code. And in the videos I've seen (one is from a few months ago) they have the same code as me.
You have a file named pymem.py that's mentioned in the exception message (specifically c:\Users\N\Desktop\PYTHON\pymem\pymem.py). This locally written pymem module is shadowing the pymem package you've installed elsewhere (python\python310\lib\site-packages according to one of your comments, though that path is not complete).
You need to rename your pymem.py file to something else if you want to be able to use the package.
I think you don't have it installed, try going into cmd, Terminal or whatever and type pip install pymem.
pip should install the package for you and you should be good.

Importing wxPython pops errors

Currently I am using Python 3.7, and Ubuntu 18.04. I downloaded wxPython from pip, but when I tried to import wx in my terminal, I get this error:
>>> import wx
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/aleejandrof/anaconda3/lib/python3.7/site-packages/wx/__init__.py", line 17, in <module>
later on, when I tried other ways like and "._core import" I received an error like this:
ImportError: /home/aleejandrof/anaconda3/bin/../lib/libpangoft2-1.0.so.0: undefined symbol: pango_font_description_set_variations
After reading some posts here, I tried deleting the wx.py and wx.pyc files, which didn't work. The same happened when I read that downloading the main excecutable file would make the import occur with no errors, but it popped the same errors.
AttributeError: module 'wx' has no attribute '__version__'
I am trying to run a GUI pipeline, which works with wxPython. I'm thankful in advance, if any of you has suggestions.
When I made an environment of ubuntu18.04 using docker, ran into the same problem.
I had multiple libpangoft2-1.0.so.0 files.
It seemed the problem was /opt/conda/lib/libpangoft2-1.0.so.0 was looked up.
To change the name of the file solved the problem.
find / -name libpangoft2-1.0.so.0
/opt/conda/lib/libpangoft2-1.0.so.0
/opt/conda/pkgs/pango-1.42.4-h049681c_0/lib/libpangoft2-1.0.so.0
/usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0
mv /opt/conda/lib/libpangoft2-1.0.so.0 /opt/conda/lib/libpangoft2-1.0.so.0-void
You may want to try:
conda install -c asmeurer pango

import yaml missing error module

>>> import yaml
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/tools/python_libs/yaml/__init__.py", line 2, in <module>
from error import *
ModuleNotFoundError: No module named 'error'
I don't see how to set my PYTHONPATH with anaconda3.
Am I missing an install step?
I have the same situation, but with the ROS. The same error reproduces when you use python 3 instead of python 2. You can see corresponding discussion
here. For some reasons I would like to use python3 instead of python2, so I need to find out, how to get rid of this error.
I can suggest two solutions right now:
Either use python2 instead of python3, as suggested in ROS discussion
Or try to install yaml with pip3 for python3 (not pip). I think it may help in this situation. See here for installation instructions.

Installing GIS for gis with Python is easy ...? not for me

I really really need your help please. The fact is my problem should seem pretty simple to you.
So I have a macbook with Lion, I use python 3.3. In order to use GDAL for GIS? I downloaded the package on this website, which is recommended everywhere:
http://www.kyngchaos.com/software/frameworks
Then I install it. It is ok, but I cannot import it in my project, here is my error.
When I type import osgeo, I have the following :
Traceback (most recent call last):
File "<pyshell#11>", line 1, in <module>
import osgeo
ImportError: No module named 'osgeo'
I know my path is not good, wherecan I change it ?
Any ideas?

Import error in Python: Polygon

I installed this library called Polygon, in Python 2.7.3. But, each time I import it I get the next error message :
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "Polygon/__init__.py", line 5, in <module>
from Polygon.cPolygon import *
ImportError: No module named cPolygon
I have no idea about what could be going wrong. And also, I have already tried to contact the original author of this on his personal webpage.
but he hasn't replied though :( I wonder if someone can help me with this issue please.
It sounds like you didn't in fact install it, but instead just copied it to your working directory. As always, run setup.py with the appropriate arguments to install.
This error can happen if you try to run python from inside the directory you used to install Polygon. Move to a different directory and try again.

Categories