panic: fail to set message file(en-US): open conf/locale/locale_en-US.ini: The system cannot find the path specified. #867

Closed
opened 2025-11-02 03:39:40 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @hsluoyz on GitHub (Jul 3, 2017).

Reproduce steps:

  1. go get code.gitea.io/gitea
  2. go run C:/GoPath/src/code.gitea.io/gitea/main.go web

The error is:

panic: fail to set message file(en-US): open conf/locale/locale_en-US.ini: The system cannot find the path specified.

I'm also using gogs, so I found that conf/locale/locale_en-US.ini exists on gogs, but it has been moved to options/locale/locale_en-US.ini in gitea. Maybe someone forgot to handle the code change when moving it? Here's a screenshot for the missing file:

image

BTW, I'm using Go 1.8.3 on Windows 10 x64.

The entire log is attached as below:

"C:\Program Files (x86)\JetBrains\Gogland 171.3780.106\bin\runnerw.exe" C:\Go\bin\go.exe run C:/GoPath/src/code.gitea.io/gitea/main.go web
2017/07/03 23:27:02 [W] Custom config 'C:/Users/ADMINI~1/AppData/Local/Temp/go-build848070066/command-line-arguments/_obj/exe/custom/conf/app.ini' not found, ignore this if you're running first time
2017/07/03 23:27:02 [T] Custom path: C:/Users/ADMINI~1/AppData/Local/Temp/go-build848070066/command-line-arguments/_obj/exe/custom
2017/07/03 23:27:02 [T] Log path: C:/Users/ADMINI~1/AppData/Local/Temp/go-build848070066/command-line-arguments/_obj/exe/log
2017/07/03 23:27:02 [I] Gitea v1.1.0+dev
2017/07/03 23:27:02 [I] Log Mode: Console(Trace)
2017/07/03 23:27:02 [I] XORM Log Mode: Console(Trace)
2017/07/03 23:27:02 [I] Cache Service Enabled
2017/07/03 23:27:02 [I] Session Service Enabled
2017/07/03 23:27:02 [I] Run Mode: Development
panic: fail to set message file(en-US): open conf/locale/locale_en-US.ini: The system cannot find the path specified.

goroutine 1 [running]:
code.gitea.io/gitea/vendor/github.com/go-macaron/i18n.initLocales(0xc042250415, 0x0, 0x10d0ee1, 0xb, 0xc0421f0db0, 0x10dd1b8, 0x12, 0xc0422122c0, 0x15, 0x15, ...)
	C:/GoPath/src/code.gitea.io/gitea/vendor/github.com/go-macaron/i18n/i18n.go:57 +0x606
code.gitea.io/gitea/vendor/github.com/go-macaron/i18n.I18n(0xc042288600, 0x1, 0x1, 0x0, 0xc0421f0db0)
	C:/GoPath/src/code.gitea.io/gitea/vendor/github.com/go-macaron/i18n/i18n.go:158 +0xf5
code.gitea.io/gitea/routers/routes.NewMacaron(0xc042287680)
	C:/GoPath/src/code.gitea.io/gitea/routers/routes/routes.go:100 +0x7bc
code.gitea.io/gitea/cmd.runWeb(0xc042287680, 0x0, 0x0)
	C:/GoPath/src/code.gitea.io/gitea/cmd/web.go:62 +0xc1
code.gitea.io/gitea/vendor/github.com/urfave/cli.HandleAction(0xf66ae0, 0x1113b70, 0xc042287680, 0xc042184800, 0x0)
	C:/GoPath/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/app.go:471 +0xc0
code.gitea.io/gitea/vendor/github.com/urfave/cli.Command.Run(0x10c434e, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10e393b, 0x16, 0x0, ...)
	C:/GoPath/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/command.go:191 +0xb52
code.gitea.io/gitea/vendor/github.com/urfave/cli.(*App).Run(0xc042480820, 0xc0420483e0, 0x2, 0x2, 0x0, 0x0)
	C:/GoPath/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/app.go:241 +0x666
main.main()
	C:/GoPath/src/code.gitea.io/gitea/main.go:44 +0x3d4
exit status 2

Process finished with exit code 1
Originally created by @hsluoyz on GitHub (Jul 3, 2017). Reproduce steps: 1. ``go get code.gitea.io/gitea`` 2. ``go run C:/GoPath/src/code.gitea.io/gitea/main.go web`` The error is: > panic: fail to set message file(en-US): open conf/locale/locale_en-US.ini: The system cannot find the path specified. I'm also using gogs, so I found that ``conf/locale/locale_en-US.ini`` exists on gogs, but it has been moved to ``options/locale/locale_en-US.ini`` in gitea. Maybe someone forgot to handle the code change when moving it? Here's a screenshot for the missing file: ![image](https://user-images.githubusercontent.com/3787410/27799519-0c6bf628-6048-11e7-9812-1304d15a3aea.png) BTW, I'm using Go 1.8.3 on Windows 10 x64. The entire log is attached as below: ``` "C:\Program Files (x86)\JetBrains\Gogland 171.3780.106\bin\runnerw.exe" C:\Go\bin\go.exe run C:/GoPath/src/code.gitea.io/gitea/main.go web 2017/07/03 23:27:02 [W] Custom config 'C:/Users/ADMINI~1/AppData/Local/Temp/go-build848070066/command-line-arguments/_obj/exe/custom/conf/app.ini' not found, ignore this if you're running first time 2017/07/03 23:27:02 [T] Custom path: C:/Users/ADMINI~1/AppData/Local/Temp/go-build848070066/command-line-arguments/_obj/exe/custom 2017/07/03 23:27:02 [T] Log path: C:/Users/ADMINI~1/AppData/Local/Temp/go-build848070066/command-line-arguments/_obj/exe/log 2017/07/03 23:27:02 [I] Gitea v1.1.0+dev 2017/07/03 23:27:02 [I] Log Mode: Console(Trace) 2017/07/03 23:27:02 [I] XORM Log Mode: Console(Trace) 2017/07/03 23:27:02 [I] Cache Service Enabled 2017/07/03 23:27:02 [I] Session Service Enabled 2017/07/03 23:27:02 [I] Run Mode: Development panic: fail to set message file(en-US): open conf/locale/locale_en-US.ini: The system cannot find the path specified. goroutine 1 [running]: code.gitea.io/gitea/vendor/github.com/go-macaron/i18n.initLocales(0xc042250415, 0x0, 0x10d0ee1, 0xb, 0xc0421f0db0, 0x10dd1b8, 0x12, 0xc0422122c0, 0x15, 0x15, ...) C:/GoPath/src/code.gitea.io/gitea/vendor/github.com/go-macaron/i18n/i18n.go:57 +0x606 code.gitea.io/gitea/vendor/github.com/go-macaron/i18n.I18n(0xc042288600, 0x1, 0x1, 0x0, 0xc0421f0db0) C:/GoPath/src/code.gitea.io/gitea/vendor/github.com/go-macaron/i18n/i18n.go:158 +0xf5 code.gitea.io/gitea/routers/routes.NewMacaron(0xc042287680) C:/GoPath/src/code.gitea.io/gitea/routers/routes/routes.go:100 +0x7bc code.gitea.io/gitea/cmd.runWeb(0xc042287680, 0x0, 0x0) C:/GoPath/src/code.gitea.io/gitea/cmd/web.go:62 +0xc1 code.gitea.io/gitea/vendor/github.com/urfave/cli.HandleAction(0xf66ae0, 0x1113b70, 0xc042287680, 0xc042184800, 0x0) C:/GoPath/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/app.go:471 +0xc0 code.gitea.io/gitea/vendor/github.com/urfave/cli.Command.Run(0x10c434e, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10e393b, 0x16, 0x0, ...) C:/GoPath/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/command.go:191 +0xb52 code.gitea.io/gitea/vendor/github.com/urfave/cli.(*App).Run(0xc042480820, 0xc0420483e0, 0x2, 0x2, 0x0, 0x0) C:/GoPath/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/app.go:241 +0x666 main.main() C:/GoPath/src/code.gitea.io/gitea/main.go:44 +0x3d4 exit status 2 Process finished with exit code 1 ```
Author
Owner

@lafriks commented on GitHub (Jul 3, 2017):

Problem is that you are running form JetBrains and it creates exe in temporary directory and it is also working directory. In your situation it is C:/Users/ADMINI~1/AppData/Local/Temp/go-build848070066/command-line-arguments/_obj/exe/ and from there it can not find locale files.

@lafriks commented on GitHub (Jul 3, 2017): Problem is that you are running form JetBrains and it creates exe in temporary directory and it is also working directory. In your situation it is `C:/Users/ADMINI~1/AppData/Local/Temp/go-build848070066/command-line-arguments/_obj/exe/` and from there it can not find locale files.
Author
Owner

@hsluoyz commented on GitHub (Jul 4, 2017):

Hi @lafriks ,

I think we should use os.Getwd() as the working directory.

Using executable path is very tricky and doesn't work for go run command. go run command will run the executable in a temp folder on both Windows and Linux. And this command very important in the development phase.

@hsluoyz commented on GitHub (Jul 4, 2017): Hi @lafriks , I think we should use ``os.Getwd()`` as the working directory. Using executable path is very tricky and doesn't work for ``go run`` command. ``go run`` command will run the executable in a temp folder on both Windows and Linux. And this command very important in the development phase.
Author
Owner

@lunny commented on GitHub (Jul 4, 2017):

@hsluoyz For Gogs or Gitea, it maybe not suitable for use go run since it will write the executable path to authorized_keys.

@lunny commented on GitHub (Jul 4, 2017): @hsluoyz For Gogs or Gitea, it maybe not suitable for use `go run` since it will write the executable path to `authorized_keys`.
Author
Owner

@lafriks commented on GitHub (Jul 4, 2017):

And for serv command used from ssh cwd will not be one needed for gitea

@lafriks commented on GitHub (Jul 4, 2017): And for serv command used from ssh cwd will not be one needed for gitea
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#867