I'm really confused. For some reason, I suddenly can't open IDLE 3.5. I have tried uninstalling it and reinstlling, but no luck. I was told to delete the folder .idlerc but it hasn't come back after constant tries. Was that a huge mistake? I have no idea what's going on.
Is it just the IDE? Or the python install itself?
When having problems using IDLE as an IDE I would recommend using PyCharm. It offers imho the best options for Python developing.
A common cause of failure of idle startup is a user-written file with the same name as a standard library module, such as random.py and tkinter.py.
First make sure you dont have a file named random.py and tkinter.py in the current folder.
All the startup failures of idle are described here.
I had the same problem. Turned out I had a python program named 'random.py'. Idle would not run until I renamed that program!
Related
It has started appearing ever since I installed Anaconda on my PC. It doesn't affect anything and when I press "Ok" it goes away. But it is quite annoying and I would like to know the reason. It has only appeared when I try to run a development server in Django or try to install python modules using pip. Is there any way to solve this?
It happens because anacondaa3\Library\bin\ in this folder pythondicom39.dll has crashed you need to replace it with a new file
Yes, that dll file might be corrupted. Just replace, and then try it. You can download the pythoncom39.dll files from the following link
https://freeonlinestudies.com/python-dlls/
I've run into an issue i don't know how to deal with. I've written a Python script in Jupyter notebook. The script works properly in Jupyter, but I need to call the script from a commandline, so I've converted it to a .py file using nbconvert. When I run the script by explicitly calling python and the script with full paths, I get an error that a module couldn't be loaded properly. It obviously didn't have any problem inside Jupyter, so I don't know what the problem with the module could be. I saw another post that suggested updating all your modules, but that didn't change the behavior. It has a problem with the PIL module.
Any help would be appreciated. I only have one flavor of Python installed and I'm explicitly referencing the python.exe file in Anaconda folder.
Thanks for any help.
Vince
Error message
I figured this out. Python couldn't find the module file because it was locked. I had the script open in Jupyter. Not sure why it was bothered by this module and not the others I was importing, but that was the problem here.
I have been using PyCharm since I began learning Python because of its amazing UI that helped me learn a great deal about the language. As I progress into more advanced projects, I am beginning to prefer using a text editor / command line combo so that I can build my own venv's and have better access to source control. My question is, how does PyCharm manage custom local packages that I created so that I can import them wherever I want in the directory? For instance a project that I have built exclusively in PyCharm that runs will raise numerous import errors when trying to run that same project in VS code, or even a command line shell (yes I did have the PyCharm created venv activated before running on both attempts). For further examples, here is the project structure I am confused about:
RootDirectory
package_1_folder
__init__.py
pckg_1_class.py
program_using_pckg_1_folder
class_using_pckg1class.py
venv
The above structure has no issues being imported and used in PyCharm, however VS code / Sublime when used with command prompt / gitbash will raise either an ImportError or a ModuleNotFound error. I have even gone as far as adding the desired packages to my laptops windows PATH, using sys.path.append (I know this is not good practice I was only trying to get it to work), and even modified the .pylintrc file with the project path with no success. Any help explaining why these errors are happening would be greatly appreciated :)
NOTE:
I have been able to use the packages in VS code as long as the program importing the module is located at the root directory level, but not in its own folder in the root directory. Again, this statement WILL work in PyCharm, I just want to know how PyCharm is able to achieve this.
After numerous attempts to locate how the system was keeping tack of module within the IDE, I found that my answer was not visible from the IDE. I found a .idea folder in my root directory that contains a few .xml documents that manage the directory including where to read modules from.
Alright just for context I'm an extreme newbie to python (around 15 minutes of experience).
My question is most likely a dumb one, but I'm gonna ask it anyways as I can't find anything about it elsewhere; Why can't I run the (very advanced) code below as a .py file? Using version 3.6 if it matters.
print("hello")
Thanks
Opening the python file will not cause it to execute.
Depending on your operating system (Windows, Mac, Linux) try opening a
command window and navigating to the file location of you python file.
Once you are in the directory (folder) of the python file that contains
the print statement run the following:
python myfile.py
Does that work?
Download and install
https://www.jetbrains.com/pycharm/download/#section=mac[Pycharm][1]
It is an IDE (Integrated Developer Environment). Pycharm will have what you need to write, save and execute python code all in the same application. There are others of course but Pycharm is as good as any to start with.
Good luck!
I created a Python file named data_loading in PyCharm and it showed up as a regular text file without the ability to run.
Then I switched the name to data_load and it worked.
I'm not sure why it couldn't run when it was named data_loading.
Is there a reason for this? I'm new to Python.
Proof here: https://i.stack.imgur.com/rZl9S.png
There's nothing inherent in Python that prevents a script named data_loading from running. Either it's something in your environment that's preventing it from running, or the file was created differently in PyCharm for some reason. Either way, we don't have enough information to diagnose the issue with certainty.
I am certain that Python isn't the issue.