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

How to use on Windows? #22

Open
FireController1847 opened this issue Jun 17, 2018 · 7 comments
Open

How to use on Windows? #22

FireController1847 opened this issue Jun 17, 2018 · 7 comments

Comments

@FireController1847
Copy link

Is it even possible to use this on Windows? If so, how?

@xagyg
Copy link

xagyg commented Jul 12, 2018

I just tried it on windows (using it in a Git Bash Shell) and it works well. I ran

python ./setup.py install

Then I had to copy the python.exe to python3.exe

Then it worked a treat!
I was delighted when I ran the following code (yes - even without semi-colons - brilliant!)

for i in range(10) {
    print("Bython is awesome!")
    print("Hello")
    if (i == 5) {
        print("yo")
    }
}

@mathialo
Copy link
Owner

Currently, I'm only developing for Unix-like systems, simply because I don't own a Windows machine to develop on.

I believe the only changes necessary to port Bython to (native) Windows is to adapt where the install script puts the executable, and find a Windows alternative to the shebangs, but I'm not sure.

If you're familiar with using Python on Windows, you are of course very welcome to look into the issue yourself and submit the changes.

@ardee00
Copy link

ardee00 commented May 26, 2021

The instructions say to run Bython in a shell. However, in Windows, there is no bython.exe. How do you run Bython in Windows?

@xXCrash2BomberXx
Copy link

Maybe my custom build would work better. I wrote it and use it on windows
My Build of Bython

@42degrees
Copy link

No offense to xXCrash2BomberXx, but I don't know if I can trust an executable downloaded from GitHub. This is easy enough to make work on Windows. Note that I install Python into C:\Python312, which means that Bython installs into C:\Python312\Scripts. I have both of these directories in my Windows path.

Here are the steps I took to make Bython work:

  1. Since on Windows the python installs as just python.exe in a directory for python3, I created a batch file in the python install directory called python3.bat that contains these lines:
    @echo off
    python %*

  2. I then created a batch file in the python install directory called bython.bat with these two lines:
    @echo off
    python "C:\Python312\Scripts\bython" %*

  3. I put a test program in c:\temp\test.by:
    print("Bython is awesome!");
    for i in range(10) {
    print(i);
    }

That's it, now I can run:
C:\temp>bython test.by
Bython is awesome!
0
1
2
3
4
5
6
7
8
9

@42degrees
Copy link

And then I looked at the project more closely and realized that the parser isn't really parsing and the whole project has been abandoned long ago. Oh well.

@pavelzw
Copy link

pavelzw commented Mar 15, 2024

You can convert the scripts into python entrypoints which you can then define in your package configuration. This makes them available cross-platform.

See https://setuptools.pypa.io/en/latest/userguide/entry_point.html#console-scripts for documentation how to do this.

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

No branches or pull requests

7 participants