Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: Bad magic number in .pyc file #20

Closed
ghost opened this issue Feb 19, 2017 · 53 comments
Closed

RuntimeError: Bad magic number in .pyc file #20

ghost opened this issue Feb 19, 2017 · 53 comments
Labels

Comments

@ghost
Copy link

ghost commented Feb 19, 2017

Hi i am using Windows 10 64bit but when i run the .pyc file it comes up with this error all the time but i had to record it and slow it down to 0.05x speed so i could see it but that only just managed to show it so i screenshotted it. It is below. Thanks!

@ghost
Copy link
Author

ghost commented Feb 19, 2017

Ok this is what i have got so far.
screenshot 157

@ghost ghost changed the title How do i do it? RuntineError: Bad magic number in .pyc file Feb 19, 2017
@ghost ghost changed the title RuntineError: Bad magic number in .pyc file RuntimeError: Bad magic number in .pyc file Feb 19, 2017
@zappybiby
Copy link
Contributor

Usually this is caused by wrong python version

Go into the pyc file and see what the magic number is

Then compare it to this list http://stackoverflow.com/a/514395/7430976
To see if you have the correct version.

@ghost
Copy link
Author

ghost commented Feb 19, 2017

Where can i find it?

@ghost
Copy link
Author

ghost commented Feb 19, 2017

Also what python is it you used?

@ghost
Copy link
Author

ghost commented Feb 19, 2017

Because i use python 3.6.0

@zappybiby
Copy link
Contributor

zappybiby commented Feb 19, 2017

Ok, so I used HexEdit to read the __init__.pyc file located in
...\ChosunTruck\ChosunTruck\linux\tensorbox\utils among other locations.

The first two byes were "03 F3" which when reversed to "F3 03" give the decimal value 62211

According to the table, this means that it was built with Python 2.5b3

@chi3236 do we need to add "Python 2.5b3" (Python 2.7) to the prerequisites?

@ghost
Copy link
Author

ghost commented Feb 19, 2017

Hmm it is PyScaffold that one so i don't know :/

@ghost
Copy link
Author

ghost commented Feb 19, 2017

If you want we can do teamviewer and you could help me?
Another thing is, it is caused by me using windows not linux?

@zappybiby
Copy link
Contributor

https://www.python.org/downloads/release/python-2712/

Python 2.7 is backwards compatible with 2.5. See if that works...

@zappybiby
Copy link
Contributor

So the windows version doesn't use tensorbox, so there is no python code to execute. It is c++, you will need Visual Studio 2013

@ghost
Copy link
Author

ghost commented Feb 19, 2017

oh i have Visual Studio 2015

@zappybiby
Copy link
Contributor

zappybiby commented Feb 19, 2017

That works, but you will need to build the OpenCV CUDA libraries with CMake. The current versions of OpenCV use 'shared libraries', meaning they took a whole bunch of libraries and put them into one. For our code, we need each library separate, also called 'static libraries'.

Since that is pretty difficult, it is much easier to use Visual Studio 2013 and follow the troubleshooting instructions in our README to get those libraries. You can have both 2013 and 2015 on your system, it will let you choose which one you want to use when starting the program.

@ghost
Copy link
Author

ghost commented Feb 19, 2017

I cannot get Visual Studio 2013 because i have to be this subscriber

@zappybiby
Copy link
Contributor

You need to login with your Microsoft account. Visual Studio 2013 is free to use once you login.

@ghost
Copy link
Author

ghost commented Feb 19, 2017

ahh ok

@ghost
Copy link
Author

ghost commented Feb 19, 2017

Still won't let me get it and will only let me get 2015 :/

@zappybiby
Copy link
Contributor

Ok, lets do teamviewer I guess.

My email is blittle65@gmail.com. Send me the ID and PW

@ghost
Copy link
Author

ghost commented Feb 19, 2017

ok i sent it, sorry i was AFK.

@zappybiby
Copy link
Contributor

How did it go? Are you still having this issue or can we close it?

@ghost
Copy link
Author

ghost commented Feb 22, 2017

i haven't tried yet as i got a reply on one of the vids from my comment saying Windows version does not work so :/

@ghost
Copy link
Author

ghost commented Feb 22, 2017

but i could try
and the only problem is i don't know how and what to do as the Windows Instructions are a little bit small and there is no tutorial :( Sorry if i cause any bother.

@zappybiby
Copy link
Contributor

Windows version works but we are still in the process of implementing input (see pull requests). As of right now input is not implemented and so the Windows version only detects lines for now. Input is essentially finished, just needs to be pushed + fine tuned.

I'll try to see if I can update the tutorial. What prerequisites do you already have? Did you install the Cuda Toolkit? Do you now have Visual Studio 2013? Did you get the Nuget packages?

You should open a new issue if the answer to any of those is no.

@ghost
Copy link
Author

ghost commented Feb 23, 2017

i have got Visual Studio 2013 but there is no build option now, well there was never one but i haven't got the CUDA Toolkit

@zappybiby
Copy link
Contributor

Follow the instructions in our readme to install the CUDA Toolkit...

@ghost
Copy link
Author

ghost commented Feb 23, 2017

ok

@ghost
Copy link
Author

ghost commented Feb 23, 2017

I'm having problems, i have installed the CUDA Toolkit and Visual Studio but now when i try to get the NuGet Gallery Opencv CUDA Contrib vc12 Release Build 3.1.0. It is coming up with errors in VS2013

PM> Install-Package opencvcuda-release
Install-Package : The current environment doesn't have a solution open.
At line:1 char:1

  • Install-Package opencvcuda-release
  •   + CategoryInfo          : InvalidOperation: (:) [Install-Package], InvalidOperationException
      + FullyQualifiedErrorId : NuGetNoActiveSolution,NuGet.PowerShell.Commands.InstallPackageCommand
    
    

PM>

@zappybiby
Copy link
Contributor

... you need to create the solution

Save all (Crtl +shift + s) then it will ask you where you want to save the .sln file. Then open that .sln file and repeat nuget

@ghost
Copy link
Author

ghost commented Feb 23, 2017

umm ok

@ghost
Copy link
Author

ghost commented Feb 23, 2017

it isn't doing anything. i sent teamviewer stuff through email again.

@ghost
Copy link
Author

ghost commented Feb 23, 2017

Thanks to zappybiby, just about everything is working but for some reason i am getting errors while building the solution and i have screenshotted my screen twice to show list of errors.
http://imgur.com/a/pLht9

@zappybiby
Copy link
Contributor

Those are linker errors. Look at our Readme on how to fix that.

@ghost
Copy link
Author

ghost commented Feb 23, 2017

ok

@ghost
Copy link
Author

ghost commented Feb 23, 2017

Right it fixed most but now i have this error
image

@zappybiby
Copy link
Contributor

Nuget should have made a folder for you with all of the required libraries. This is usually in your main directory (\ChosunTruck)

You need to link to those, not to the opencv folder.

@ghost
Copy link
Author

ghost commented Feb 23, 2017

ahh ok

@ghost
Copy link
Author

ghost commented Feb 23, 2017

which one redist or the other?

@ghost
Copy link
Author

ghost commented Feb 23, 2017

i tried both and still the same error

@ghost
Copy link
Author

ghost commented Feb 23, 2017

image

@ghost
Copy link
Author

ghost commented Feb 23, 2017

Now it says this.
image

@AntonioCS
Copy link

@keyring52 Please google the error msg

Second thing I found with a quick google search: http://stackoverflow.com/questions/15978035/cannot-open-input-file-opencv-calib3d243d-lib

@ghost
Copy link
Author

ghost commented Feb 23, 2017

ahh i'll try that
EDIT: i checked and everthing is alright and all correct it just keeps saying that error so i'll reinstall the opencv thing

@ghost
Copy link
Author

ghost commented Feb 23, 2017

wait if i take the "opencv_calib3d310.lib;" out it goes to next one and says same thing cannot open.

@zappybiby
Copy link
Contributor

Ok, so all of those files are required for the program to run. If you take one out, it moves on to the next one, but it will not run without that file. You need to search for that file on your computer. Use the search box in your chosuntruck directory to find the folder containing the files you need.

@ghost
Copy link
Author

ghost commented Feb 23, 2017

i have found them but nothing is wrong to me it all looks how it should

@zappybiby
Copy link
Contributor

Again, opencv 3.0+ switched to shared libraries. We need static libraries that are obtained from nuget. You need to link to the nuget libraries. Reinstalling opencv will not fix this.

@zappybiby
Copy link
Contributor

All I can tell you is that he error you are gettng is because Visual studio is not finding the file. Try altering the include directories again. Double check your linker directories too

@ghost
Copy link
Author

ghost commented Feb 23, 2017

ok
i kinda changed the directories and it all shows up properly and works then i get this.
image

@ghost
Copy link
Author

ghost commented Feb 23, 2017

Reinstalled it and i get this now
image

@zappybiby
Copy link
Contributor

You are getting the same error (lnk1104)

Look at solutions here: http://stackoverflow.com/questions/133698/why-does-fatal-error-lnk1104-cannot-open-file-c-program-obj-occur-when-i-c

Maybe run VS as admin.

@ghost
Copy link
Author

ghost commented Feb 23, 2017

It's gonna have to be teamviewer again as it isn't working again and it is different error now

@ghost
Copy link
Author

ghost commented Feb 23, 2017

wait nevermind i'll try again later

@zappybiby
Copy link
Contributor

@keyring52, you need to close this issue and, if you are still having problems, create a new one called "Error LNK1104". This thread has gone completely off topic from its first post. Paging @chi3236 @bethesirius, can one of you close this! Thanks

@ghost ghost closed this as completed Feb 24, 2017
@ghost
Copy link
Author

ghost commented Feb 24, 2017

Closed issue :)

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants