so basically i am trying a change prefix command and i want to fix the directory
i am trying to do import cogs.json in this
file directory
I realize that i get the errorModuleNotFoundError: No module named 'cogs' because of the directory of files but i dont know how to fix the directory to go there
can anyone help?
`i am trying to go to the _json.py inside of the cogs folder, besides that i might try just moving the _json file into the bot folder if that might work
Use
from cogs import _json
also, if you want you can rename your local name for the package
from cogs import _json as jsonModule
if this doesn't work, try
from ..cogs import _json
For more help, please look at this https://docs.python.org/3/reference/import.html
Related
Basically, my question is, why is it putting an underscore in front of my import path?
It says import path does not begin with hostname which I'm assuming is because it starts with an underscore.
I read somewhere this may have something to do with me screwing up my GOPATH, but I've tried moving it everywhere, inside the project folder, outside the project folder, in the default location, etc.
I'm new to go and this has come up a few times recently. Would appreciate any guidance!
So I was misunderstanding where my source code had to be.
For anyone in the same boat, it needs to be within the go path in the actual src folder.
I found this helpful.
I have created a go script that compiles, starts, checks the status, and ends a web service I created (that is also in go). However, I have come to a road block.
With the compile feature I run the following command:
go install .
Which gives the following error:
./script.go:55: main redeclared in this block
previous declaration at ./hello.go:8
Which makes sense as I have two different files, both with the main func and main package. I also tried moving the script to another folder and then changing the command ran to:
go install {path}
Where {path} is equal to the path I want installed/compiled. Which I then got the following error:
exit status 1: can't load package: package /var/www/test.com/go: import "/var/www/test.com/go": cannot import absolute path
So in conclusion I have thought of only one solution (and I am up to hear others if mine isn't the best approach). My idea is to exclude the script file from compiling with the rest of the files, but I am unsure how to.
I did some research and couldn't find an easy way to do it (such as an --exclude flag with the go install command). Does anybody know how to accomplish what I am trying to achieve?
Thank you.
you could give the hello.go a different package name, that should work. Or i am missing something?
Regards
Tim
I'm stuck on running the BeeGO app using "bee run" it says
The thing is I've already have setup properly my GOPATH to D:/Web Dev/GO/BeeGO/test-project/
and also routers path does exist and I've tried to manual build the file but it doesn't generate an .exe file.
Anyone knows how to fix this?
I'm using Windows 8.1 Pro (64-bit)
Thanks
GO expects the directory structure under $GOPATH in following ways as described in code organization:
$GOPATH/src <--- where your source code goes
/pkg
/bin
Instead of placing your source files directly under $GOPATH (D:/Web Dev/GO/BeeGO/test-project/ for your case), you want to move your code under $GOPATH/src.
D:/Web Dev/GO/BeeGO/test-project/src/main.go
D:/Web Dev/GO/BeeGO/test-project/src/quickstart/routers/routers.go
D:/Web Dev/GO/BeeGO/test-project/src/quickstart/controllers/controllers.go
import path should be always starting from $GOPATH/src. routers.go can be always imported as import "quickstart/routers" and controllers.go can be imported as import "quickstart/controllers".
That's not how you import a package.
The import path is relative to $GOPATH/src. use:
import "quickstart/routers"
Finally fixed the bug from the framework,
What I did:
in main.go import from
"D:/Web Dev/GO/BeeGO/test-project/quickstart/routers"
I changed it to _"../quickstart/routers" make sure to include _ this means to import the library even if it is not used,
Then in the routers/router.go I changed the import path
"D:/Web Dev/GO/BeeGO/test-project/quickstart/controllers" to "../controllers"
It seems BeeGO doesn't generate the template properly and caused the build to fail.
Another possiblity for this error, is when you copy-paste code from the internet,
and
import "quickstart/routers"
became
import "quickstart/routers "
due to bugs in some CMS/Blog systems (notice the space at the end before the closing quote...).
i'm trying to install three.js imports add on on blender 2.69, i'v tryed to copy the io_mesh_threejs into my ~/config/blender/2.69/script/addons but no entry in my blender addon menu.
I then move the __init__.py file there :
io_mesh_threejs into my ~/config/blender/2.69/script/
and then i have the entry menu, that i then select.
i tryed to export the basic cube to test it, but i have an error message :
.../init__.py", line 336, in execute import io_mesh_threjs.export_three.js
importError:No module named'io_mesh_threejs'
location:<unknow location>
---- my solution -----
I'm not sure it's the right way, but anyway, i copy the init.py and the 2 other file (import and export one) and put them dirctly on the addon repertory : /usr/share/blender/(...)/addons/
as it seems not to find the io_mesh_threejs i then change the line 336 and 337 of the __init.py file as this :
import export_threejs
return export_threejs.save(self, context, **self.properties)
it seems to work as i've now a threejs-test.js (the name i gave when saving) file in my personal dirctory, and when i open that file i've got an object.
i then trid the import module, it seems that the same tweak had to be done on line 146.
Now export and imports work
if it can help.
i then try to copy the directory io_mesh_threejs in the modules' one but noting better, as well as moving __init__.py on the /usr/share/blender/.../addon one
i read that people succed in using this plugin with 2.69, so i'm looking for help, thanks by advance :)
I had the exact same issue. Instead of messing with the files i just restarted blender. That worked for me. Not sure why you had to change the files.
Need Solution for the below error. I have dump file to restore in a database. But got a error during import.
IMP-00002: failed to open C:\oracle\product\10.2.0\NEFT_IFSC.dmp for read
Import file: EXPDAT.DMP >
There are lots of things it could be: file path is wrong, file is corrupt, file is too big, permissions on the directory, file name is wrong, and so on.
You may find it helpful to run your import using a parameter file. Not only will that save you some typing if you end up re-running this several times, it will give you the possibility to review what you're about to submit. Find out more.
Also you can set the SHOW=Y parameter to validate the contents of the file.