.py files start giving import error out of nowhere - import

I'm importing some python files in my colab using from 'xxx ' import 'xxx' , but sometimes it stop being recognized even if I don't do any change in the code
Example of the error message:
enter image description here

It may be that you have two different installations of python installed. There may have been an issue deleting an old version of the Python environment when you updated, or you downloaded the Microsoft Store installation and have both at the same time which could cause issues.

I've had this issue before, and it was mainly because I was running the file wrong. When you run a file, it adds the file directory to sys.path, which is where it stores package directories. If you are not running the main file, and instead you are running the file individually, that might be the issue. This can be solved by using sys.path.append() or just running the program from the main file. (I might have misunderstood the question so I apologize if this doesn't help)

Related

VSCode Cannot Execute Julia FIles

I've scoured other forums that talk about this problem and have tried all of the recommendations I've found, but I cannot seem to get VSCode to recognize my Julia.exe path and execute commands in a .jl file. Every time I run even a simple .jl file, I get /bin/sh: julia: command not found (pictured below).
I have ensured that the executable path is set properly in the .json file, and have tried moving the executable to other locations (using an M1 Mac), but it seems it still cannot find/recognize the Julia.exe:
I have even tried just pointing to the binary folder /bin, and /bin/julia.exe (with the extension), and though VSCode does not generate the error when it cannot confirm the .exe path, the actual code still generates the error above.
I'm at my wits end here. I'm sure it's a simple answer that someone could spot in a second, or know the troubleshooting for, but I've never had this issue to this degree before with installing other languages like Kotlin. Any help is greatly appreciated.
Problem was fixed by the MacOS recommendation found here:
julialang.org/downloads/platform/#optional_add_julia_to_path
Copying the binary .exe elsewhere (outside of /Applications) and changing the executable path in VSCode fixed the issue.

Visual Studio Code debug mode issue

I'm sorry to bother , I don't know if I can ask this
Visual Studio Code, suddenly can't use debug mode to set interrupts to test.
It seems that it is talking about the folder name problem, but after accessing the folder, it will not be renamed. How can I solve it now? I can't upload photos so I'm capturing the important parts.
i.e.: the module "queue" could not be imported because it is shadowed by:
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/queue/__init__.pyc
Please rename this file/folder so that the original module from the standard library can be imported.
Not sure how to change folder name or duplicate name, these actions are forbidden after accessing the folder, or is this some other problem?
This looks like an actual issue in VSCode - https://github.com/microsoft/debugpy/issues/886
In case you're using python 2.7, Downgrading the python VSCode extension should help.

'no module found' error in Python 3.9 for windows 10

I'm a total beginner in Python, I'm reading 'Learning Python' by Mark Lutz and following along in the book. I created a file called 'script1.py', saved as an 'all files' (as opposed to a .txt file) in notepad. The name of the file, code, etc. is verbatim to that which the book instructs.
I know script1.py is there and works, I know this because when I enter 'py script1.py' in my command prompt or git bash, it correctly outputs the product of the code.
The book instructs me to run 'import script1' in Python. When I do, I get the 'module not found' error. I've tried importing as stated above, a from-import command, moving 'script1' to and from different directories. I confirmed my PATH was set up to support python, nothing.
It seems (to my UNtrained eye anyway) that python isn't finding my files. Any and all help would be greatly appreciated. Thank you.
Remember that you can only import python files into a python program. In your File Explorer, make sure that file extensions are shown and verify that your script is script1.py and not script1.py.txt or something of that sort.

Unity - unity error cs2001 source file could not be found 2018

Ever since i updated my Unity, It keep telling me
error cs2001 source file "Scripts.cs" could not be found
I even tried creating a whole new project with new file and still getting this problem.
Anybody knows how to fix this problem!!!!!!
Sorry for my English.
Unity Version 2018.1.0f2
enter image description here
If the missing file is a script that you've renamed or deleted, simply recreate a script with the same name in the location mentioned. Then let Unity recompiles the scripts. Once successfully compiled feel free to delete the file if it no longer is necessary.
Check the folow:
1 Location of your update files in linux have 777 permissions for the user you have?. Or your file is in the location?.
2 path to the file correct writely?. You know in Windows or Linux use / or \ test it
3 your file have a name with extension correctly?
I hope this helps
Today I ran into that same problem as well after restoring a Windows system restore point. I assume that Windows restored some old Unity cache files in that process which led to that error.
Simply creating the missing file(s) works. But if you did a lot of changes / renames / removals recently you may have to re-create quite a lot of files to make it compile again.
If you're using version control like Git or SVN you can jump back to an earlier point in your change history (one where the probelmatic files still existed), let Unity compile and then go back to your current state.

Unable to read package metadata. This may be due to missing repodata directory. Please ensure that your install tree has been correctly generated

I am new for centos installation. I downloaded a minimul version of centos 6.5, around 339.7mb of size. I am trying to install this with GUI interface but I got an error after selecting the drive option, which comes after selecting the country.
This is complete message,
Unable to read package metadata. This may be due to missing repodata directory. Please ensure that your install tree has been correctly generated.
Failare:
repodata/743fec56b2af0ce8d6ec82c47a4efafc2a4d18cddfa9683f29611cb18d1a33de-primary.sqlite.bz2 from anaconda-CentOS-201311271240.i386: [Ermo 256] No more mirrors to try.
Sorry but I am new here, so I can't put the exact image here.
I believe that i had this same issue and was able to solve it.
The files under the /repodata folder are missing their file extensions and are not matching their full names in the "TRANS.TBL" file, under this same dir.
Rename all the files to match what is in the "TRANS.TBL" file, then try the install over again.
Please let everyone know if this works for you.
In the past i would just put a URL in that pointed to the correct files on a server, i feel that most people take this workaround and that's why it's not as hot of an item as it should be. I hope this gets fixed in the .ISO.
Thank you,
YourFriend
It worked for me.
I renamed all 8 files.
i.e. 0e371b19e547b9d7a7e8acc4b8c0c7c074509d33653cfaef9e8f4fd1d62d95de
0e371b19e547b9d7a7e8acc4b8c0c7c074509d33653cfaef9e8f4fd1d62d95de-primary.sqlite.bz2
The correct file name is given in file "repomd" under folder repodata
example - location href="repodata/b124f0ec5323cfee56b420906a3103f0daef656dde3f7ac8220120aa7504e57a-primary.xml.gz"
I had exactly the same issue ;
under "repodata" directory opened "repmod" xml file
Searched file name within repmond xml file
Found matching strings
Renamed 8 files as specified in .xml file
and it worked like a charm
Thanks to "Your Friend"
I had the same problem. Even if you manage to get past this step, you will encounter at a later point other errors related to filenames.
The root cause was using Unetbootin to create the bootable media. I switched to Rufus and everything works fine now.