python undefined method `import' for main:Object - python

After messing around with Python this evening I've managed to get the error message in the title.
I'm new to Python so I wasn't expecting to master it overnight but somehow I've managed to break the most rudimentary feature.
The last thing that happened before it broke was installing Lapack.
Running Windows 10, Python 2.7
Any advice? Hoping not to have to uninstall and start again.
Thanks.

Related

tried to install spleeter, got miniconda, then anaconda, then python, then it broke and I wanna start over

Please help I don't know anything about code or anything. I just wanna install spleeter but got and made great progress with the million steps of troubleshooting. Now I wanna delete miniconda, anaconda and python. I went to finder to delete the python folders, then i typed in the code that's supposed to delete miniconda, then anaconda, but it wouldn't stop telling me "ValueError: bad marshal data (unknown type code)" google says that this indicates a python corruption so i told it to downgrade, this didn't work, i tried to put it back, it didn't work
this is so frustrating i just wanna purge it all and try again. It's the only stuff I've ever done with this so if there's like a nuke button, that'd be best

Python Pip broken: error sys.stderr.write(f“ERROR: {exc}”)

Good morning everyone,
MacBook Air 2017.
I am new to code, and I have just started to learn a few lines of Python. I had installed version 3.8 a few months ago, and now I have started learning a bit more seriously. I found out about the pip command, but trying to install the docx pip through "pip install python-docx" showed me an error.
To be completely honest, I started to watch on the internet how to fix this problem, but I didn't really understand what I was doing. I tried to install Pyenv to somehow correct the error by making Python 3.9.4 the default version for the Mac, following this website https://opensource.com/article/19/5/python-3-default-mac. I tried to modify the .bash trough "touch ~/.bash_profile; open ~/.bash_profile", hoping this would somehow fix the issue following How do I edit $PATH (.bash_profile) on OSX?. In the end, I just decided to uninstall both 3.8 and 3.9.4 to somehow start again through https://apple.stackexchange.com/questions/284824/remove-and-reinstall-python-on-mac-can-i-trust-these-old-references, but nothing happened. At this moment in time, I have no clue what happened and if somehow I have made things even worse (which I probably did).
Right now, whenever I use any command with pip an error comes up, and I don't know how to fix it in order to be able to use modules & pip in Python. The error could be the same as the following one that I have attached to the post, which comes up after writing commands in terminal:
Image with a few errors
Thanks a lot, Bye.

cannot seem to open python idle 3.9. Win10

tried re-installing more than once. tried opening from cmd and get the following error: python error
Am new to programming so stuck trying to solve this.
things tried: re-installing (user only, all users), previous version 3.8
things i know: a previous software seems to use python files under 2.8 something.
any help is much appreciated.
Thanks

So I am trying to run a python script on my mac using atom and for some reason it is not working right

it might be a pathing issue since the first error I got on script was the pygame module not existing and after trying to install the module on the terminal i keep getting a DEPRECATION message saying python 2.7 reached the end of it's life.......
I'm trying to figure out how to set my atom text editor path right and figure out how to use pip 3 on the terminal any advice on what to do?
just for context this was all working until sometime ago. I haven't downloaded anything since then.
Have u tried simply uninstalling python and reinstalling the newest version? Had this issue some times when teaching python, and uninstalling + reinstalling plus considering the correct environment variable path ( https://discuss.atom.io/t/running-python-on-atom/49460) solved it always so far, good luck!

Using Pexpect with Python 3

After hours of research I have broken down to posting. I am trying to use the Pexpect module with python 3, which I am led to believe is possible from the document page which does say it will run with python 3.2.
Things I have tried: I have tried many different ways of installing including downloading the source and running the command sudo python3 setup.py install. I have also tried installing it with pip and *easy_install* which is what the documentation suggest. It seems that everything goes off with out a hitch until I attempt to import the module in the pyshell. When I type import pexpect I get the error:
class spawn(object):
File "/usr/local/lib/python3.2/dist-packages/pexpect/init.py", line 286, in spawn
write_to_stdout = sys.stdout.buffer.write
AttributeError: 'PseudoFile' object has no attribute 'buffer'
I have also tried googleing the error with no luck. And I have tried using python 2.7 and it works fine. I have tried on multiple debian based operating systems: Ubuntu 12.04 and Kali with the same results.
I feel like there is something obvious I am missing, but I just don't see it. Any points in the right direction Or helping me understand the error message would be much appreciated!
There was a bug in Pexpect 3.0 which stopped it working if sys.stdout was replaced before it was imported. It looks like IDLE replaces stdout, so as you've found, it doesn't work in IDLE & Python 3.
The bug has now been fixed. I'll try to get a new version of Pexpect out in the next few days, and then you'll be able to use it from IDLE.

Categories

Resources