Sublime Forum

cannot compile python

#1

C:\Users\user\AppData\Local\Programs\Python\Python311\python.exe: can’t find ‘main’ module in ‘C:\Program Files\Sublime Text’
[Finished in 78ms]

0 Likes

Unable to create a new file
#2

Your custom sublime-build file is incorrectly trying to execute folders instead of files. I would recommend using the one that ships with Sublime directly, and if you need to modify it, create a new one based off of that one instead.

0 Likes

#3

since i do not have any idea about custom sublime, and i have reinstalled sublime and it still does not work.

0 Likes

#4

have no idea where to look for custom. or how to use it. or how to remove it.

0 Likes

#5

C:\Users\user\AppData\Local\Programs\Python\Python311\python.exe: can’t open file ‘C:\Program Files\Sublime Text\test.py’: [Errno 2] No such file or directory
[Finished in 159ms] i started with new file that is the result. Now either tell me how to fix it or please return my money. I uninstalled and reinstalled python. I uninstalled sublime and reinstalled. C:\Users\user\AppData\Local\Programs\Python\Python311\python.exe: can’t find ‘main’ module in ‘C:\Program Files\Sublime Text’

0 Likes

#6

I don’t work for SublimeHQ and have no power to return money to you. If you want a refund, you will have to contact sales at the email address provided in the email that was sent with your license.

Under no circumstances should you be storing your own personal files inside of the Sublime Text installation folder.

For one thing, when Sublime updates, your files will be lost because you’re not supposed to put them there.

Also, user space programs are usually blocked from accessing the location in which applications are installed for security reasons, which could well be the reason for your issue.

A fresh installation of Sublime Text, in the presence of an installed version of Python, with a file containing Python code that is saved to disk with an extension that ends in .py will execute directly out of the box with no errors or any setup required.

0 Likes

#7

as near as i know i am not storing my personal files in anything, having uninstalled and reinstalled making no additions to anything, just doing right out of the box, cannot get it to work

0 Likes

#8

i thought sublime was supposed to be used to create programs using python code. Not sure how to create a file containing phyton code without using something to create it.

0 Likes

#9

and thanks for your help

0 Likes

#10
  1. In the Sublime menu choose File > New File from the menu; a tab appears
  2. Enter print('hello') into the new blank panel; you will see the tab title change to the text because the file has no name yet
    3.In the Sublime menu choose File > Save to open the save dialog
  3. Navigate to your Desktop in the file dialog and choose to create a folder; name it PythonCode
  4. Still in the file dialog, navigate inside of the PythonCode folder
  5. Enter the name hello_world.py and press save; the tab title changes to the name you just entered
  6. In the Sublime menu, choose Tools > Build System > Automatic
  7. In the Sublime Menu, choose Tools > Build With
  8. When the panel appears, choose the build that says Python, NOT the one that says Python - Syntax Check
  9. A panel opens at the bottom of the window with the results of the build

If you have Python properly installed on your system, the result will be the text hello.

0 Likes

#11

Thanks. seams to work. I will need to play with it a bit to understand it. Again thanks. i will uninstall sublime and reinstall vanilla and play around with it

0 Likes

#12

Dear @bobhill

This messge isn’t gonna solve your immediate problem, but might help you with some other stuff, so apologies in advance…

Sublime Text is a great piece of software, however if you are a beginner there’s a steep learning curve (well there was for me.)
(I did learn lots of good stuff though in my journey, though at times it was hugely exasperating).

Also in the context of much of the world of I.T. You’ve bough a license where so much other stuff is ‘free’. I use linux, it’s ‘free’, Android Studio, which is probably millions of lines of code, and is ‘free’. Text editors are free. IDEs are free. I upcycle old tech so even much of my hardware is ‘free’. Also how much knowledge and entertainment is on the internet? Also free. So paying for something in this environment, you’d think (perhaps rightly) that there should be some service and pronto (and I used to agree and still kind of agree…)

You’ve paid for something, and in the rest of the world that entitles you to some service, but here in the context of soo much free stuff, shouldn’t we be paying for something? If a piece of software has taken years to write, shouldn’t we pay for it ? The ST team is 3 people and they work on this a full working week, shouldn’t they be paid? Now unfortunately the ST team being 3 people the customer service is, how can I put this ‘occasionally a bit wobbly’ (Before the flamers get stuck in: I can still remember the ST3 -> ST(4) episode.) They have no dedicated customer service team, (which personally I think is an issue, but money, resources)

What you’ve paid for is the work that’s gone into writing the code, personally I’d go for a bit of a try out before buying the licence, which you’re allowed to do… I appreciate it’s real frustrating when something doesn’t work (trust me I’ve been there sooo many times) and usually to get to a forum when you’re at the end of your tether after several hours of messing about.
And you’ve paid for it! I had trouble with an apple product (2nd hand), and someone phoned me up (out of the blue) to help out (They’re paid to help out, huzzarghs). However Sublime Text isn’t microsoft or apple or a tech giant in anyway shape or form and they don’t have the resources. I did have a quick look at VSCode, I couldn’t find much help for that, there’s more help on this forum, than for VSCode (maybe that’s changed). So not all large companies are falling over themselves to help us all the time…

So the purpose of this message, unfortunately isn’t to solve your immediate problem, but to perhaps give you a little insight into what’s what. Folks try and help most of the time but they’re giving their time for free (I should be working on an Android project for example :wink:). There’s also a discord channel and github where you can get help too (which I can’t find at the mo, sorry, maybe someone else will jump in with that).

In summary, the ST dev team is microscopic and therefore no dedicated customer service, there’s a steep learning curve for beginners, you’re paying for the work of that team. You can try out for free.
It’s taken me 4 months over 2 years to get a good grip on it, I’m at the point where buying a licence for me seems like a good idea for
me.
I wish I’d known all of the above at the ‘start of my journey’ might have saved me a bit of stress !

Re python I used Spyder and ST along side each other, Spyder to do the debugging and ST to do the code editing ?

Ps Don’t know if it’s still the case on start of ST install Package Control and then Package Dev.
ctrl+shift+p then type into that search bar Install Package Control, then do the same for Package Dev (ie ctrl+shift+p, “install package dev”), those will help you alot.
Also I found this article which might also help…

Final P.S. It is worth sticking with, I think you’ll come to realise in time it’s a pretty cool piece of software, it’s not perfect, but it is pretty cool and very useful. (I was using it to debug Cython compile errors in a buildozer and kivy build, tens of thousands of lines of code to look through, ST helped a lot, only took three days to debug that (instead of years)!)

0 Likes

#13

Thanks for the response. I agree that there is a lot of free stuff, and for the most part i will try it for a bit, then pay for it. I feel that someone took the time and effort to create it, then should get paid for it. This is the first product that i have a problem with that i could not get to some one who actually created it. I have had a few responses from the forum, have tried them. I have gotten it to work after a fashion. I am just playing with this for fun, do not plan to really get in to anything serious. I have been retired from ‘IT’ for a lot of years, started back in the late 1960’s. been on main frame’s and mid range computers for a lot of years. So just playing with ‘PC’s’. Again thanks for your response, have a good day.

0 Likes